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 trialLonnie Davis
2,122 Pointssoccer league coordinator project problems
project requirements ask you to make a dictionary with values that are both strings and intergers. how do make this work?
9 Answers
David Welsh
9,298 PointsSo I have been playing around with this for a few days and I think I might be headed in the right direction. I created an array for each type, that way I can always classify the arrays together if needed by an index number. Not sure if that helps you out, but it might get you going, or thinking in a different direction. I still haven't completed it, stuck on a few loop issues, but I think I should have it by tomorrow, and will report back here if my plan worked.
Zachary Kaufman
1,463 PointsCan you do two dictionaries and use a for loop to iterate through them when you require the values from both? I am somewhat new to Swift so I am not sure how else to have a dictionary with Int and Strings
David Welsh
9,298 PointsI finished this one today and stuck with my plan. I imagine there are many methods to solve this one, but I made each attribute into an array, then used index numbers and loops to match the teams up. I'm not sure how one would solve this with dictionaries, though I imagine it can be done. Hope this helps.
Lonnie Davis
2,122 Pointsthanks for your feedback. project instructions explicitly state to place each players data in a dictionary. i am making the height integer a string. i found a method to make it back into an integer if needed.
David Welsh
9,298 PointsLonnie, you may have something slightly different than me. For mine, the instructions read, "Please choose an appropriate data type to store the information for each player. In addition, create an empty collection variable to hold all the players’ data." It then goes on to explicitly state, "Native types and collections to store data (Dictionaries, Arrays, Ints, Strings, etc...)", and I take this as use whatever tools are available. I'm not saying you are wrong, just that the instructions may be slightly altered on a case by case basis.
I remember using that method before, and searched for it for a while. What was the method to turn the int to a string?
Lonnie Davis
2,122 PointsDavid, my project instructions read as you stated but in the section "What makes a good project?" it
states
Needs Work If
Any of the following collections are missing:
Array of Dictionaries for Entire League
Array of Dictionaries for each of three teams
Dictionary for each player
also reference to required dictionary for each player and team is stated in pre project video.
method to change String to Int let x = Int(String Variable!)
Lonnie Davis
2,122 PointsDavid, i'm glad to talk to someone else in the tech degree program. maybe we can work on projects together in future.
David Welsh
9,298 PointsYeah Lonnie, sounds good.
David Welsh
9,298 PointsLonnie, which tech degree version are you doing? the $99/month or the higher rate? I only ask because I was doing the tracks for a little while, then when I saw they dropped it to $99/month, I had to jump on the tech degree. I asked the support and they mentioned they were doing the tech degree in tiers, and the lower end, the 99/month, didn't include the tutoring by an instructor and didn't allow for grading of the apps we build. I saw that their were only two tutoring sessions offered throughout the entire tech degree, so I figured it wasn't worth the extra few hundred dollars a month. I wanted to see if you were on the higher rated one, and if it offered any other features.
Zachary Kaufman
1,463 PointsI am in the 199 dollar TechDegree (but only since yesterday). The main thing it offers that the 99 dollar one doesn't is the slack channel. Which is where I get pier reviews and help. Like I said I've only had it since yesterday but the slack channel seems to be pretty worth while and will be a great help. It is also the only place I can get graded for my projects since teachers don't grade the 199 dollar plan projects.
David Welsh
9,298 PointsSo, I took a couple days off and jumped back into it. I changed all the individual arrays I had to a single, league dictionary of arrays and performed logic on that. My question, why do they ask for "An array of dictionaries for each team" and "and array for each player" in the "What makes a good project tab"? I fell like all that is needed is an array for the teams, and I can't see why you need to have a dictionary for each individual player.
For instance, after my dictionary of arrays, I separated the experienced players and non experienced players. I used logic of incrementing an index number in a "while loop", and using an "if" statement, added experienced players to each team, then non experienced players as well, plus wrote a "print" statement to parents. I didn't need to explicitly write out a dictionary for each player or make a dictionary for the teams.
Let me know what you guys think.
Carldon King
iOS Development Techdegree Student 5,651 PointsMy issue with this problem is the fact that they told us not to use anything we "haven't learned yet". We can only use the tools learned in Swift basics, Collections, Control Flow and Functions. They NEVER mention how to unwrap optionals so when I use an array of dictionaries, I can't pull any of the information out of the dictionary without unwrapping it. It will be an optional. If I unwrap it my project may not pass because I'm using things I "haven't learned yet. Like the Int to string method hasn't been taught up to this point, so technically your project would not pass.
Alex Millius
iOS Development Techdegree Student 5,468 PointsZachary Kaufman,
When you say " It is also the only place I can get graded for my projects since teachers don't grade the 199 dollar plan projects. " did you mean "since teachers don't grade the 99 dollar plan projects" ?
If I submit my project with a 99$ plan, I wan't know if my project is correct?
Zachary Kaufman
1,463 PointsNo, the 199 plan does not get graded by a teacher. Well let me rephrase, the 199 plan is made to not be graded by a teacher. Once treehouse is done with this transition, everyone in the 199 plan will be responsible for pier reviewing other students projects and having their own projects graded by other students. Teachers will not grade it. Right now my projects would be graded by a teacher but that's because they don't have the system set up yet. The 99 plan doesn't get the pier review system or teacher grading.
Luka Dadiani
15,397 PointsSo did you guys end up solving this one? I am still stuck on trying to create a dictionary of different types
Luka Dadiani
15,397 PointsFor anyone looking later on I overcame this issue by using AnyObject : let player12: [String: AnyObject]
Though you have to import foundation at the top (idk why tho)
David Welsh
9,298 PointsDavid Welsh
9,298 PointsLonnie,
I see what you are saying now. I clicked on the other tab that had a list of parameters for what needs work and saw it there. Looks like I have more work to do.