Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAlex Nelson
iOS Development Techdegree Student 6,173 PointsQuestion on restricted methods for solving Project 1
Hi there, I noticed in the instructions the following "Please don’t employ more advanced tools we haven’t covered yet, even if they are right for the job. (Yes, that means no classes, structs, tuples or filters on Project 1.) However, if you identify a place where a more advanced tool is appropriate, please mention that in a code comment."
Just curious why tuples were not allowed since we covered tuples in the three courses preceding the project. I was looking to store all of the players in a dictionary with the player name serving as the key and a tuple with height, experience and guardian names as a tuple for the value.
2 Answers
Alex Nelson
iOS Development Techdegree Student 6,173 PointsHey Ben, sorry for the late reply (didn't see the notification) but in any case, the project was approved. I used it in this manner:
let soccerPlayers: [String: (hasExperience: Bool, height: Double, guardianNames: String)] = [
"Joe Smith": (true, 42, "Jim and Jan Smith")
...
Appreciate updating the project and thanks again for the response!
Ben Jakuben
Treehouse TeacherHey Alex! The intent is to practice specifically with those concepts covered in the first few courses. That said, it sounds like we missed in the Functions course when listing out those types to avoid! Can you give me an example of how you are using it? It doesn't seem like the best way to represent the data, but it does look like you could make it work.
FYI, I have a draft of an updated version of the project that gets a little more specific about certain data types to use to help avoid some of this ambiguity and also allow us to build in some automated functional testing to help with validating projects at scale. :)
Paul Karim
3,428 PointsI'm having a issue with the rule on only allowing a [String: String] to hold ALL data per player, perhaps i'm misunderstanding this rule but simply allowing a single key,value pair doesn't seem to make sense considering the information that needs to be held. Even Alex Nelson above used String:Tuple.
I already asked in the slack channel so hoping to get a response back soon :)
Ben Jakuben
Treehouse TeacherBen Jakuben
Treehouse TeacherThanks for the example! That's a clever way to do it. I think it's slightly more cumbersome to parse down to the data in the tuple, but that might just be personal preference. Hope you don't mind - I edited your code down to one example just to avoid the ease of others copying and pasting this whole block into their own projects. ;)