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 trial
Deepak Gaire
1,482 PointsBug in dictionary
let currencies = ["US":"Dollar","UK":"Pound","JP":"Yen"] How can i assign the value for a key "UK" to a constant name ukcurrency .......
5 Answers
Christopher Augg
21,223 PointsYes, that was a hint. Just put the key where I have What Goes Here. You have to use the KEY to get the VALUE in return
let currencies = ["US":"Dollar","UK":"Pound","JP":"Yen"]
let ukCurrency = currencies["UK"]
Christopher Augg
21,223 PointsDo you mean something like:
let usCurrency = "Dollar"
let ukCurrency = "British Pound"
let jpCurrency = "Yen"
let currencies = ["US": usCurrency , "UK": ukCurrency, "JP" : jpCurrency ]
Deepak Gaire
1,482 PointsThe bummer says you must have 'let curreny ' defined
Christopher Augg
21,223 PointsOh, you are doing a challenge. I thought you were trying to write different code as a matter of practice. Which challenge is that? It is not listed that you are asking a question for a particular challenge.
Christopher Augg
21,223 PointsSorry about that. I found your challenge. You just need to do the assignment.
let currencies = ["US":"Dollar","UK":"Pound","JP":"Yen"]
let ukCurrency = currencies[WHAT GOES HERE?]
Deepak Gaire
1,482 PointsYup you are right thats problem ...., do you know solution ...
Deepak Gaire
1,482 PointsSorry for that i am beginner and its my first time that i post a question in treehouse forum ....so got little out of way ... So its the challenge of dictionary in swift basics ........can you help me ........ First step was to make a dictionary with constant name currency and to insert key and its value as a country and currency simultaneously ..... First step answer is this let currencies = ["US":"Dollar","UK":"Pound","JP":"Yen"] and in next it was asking me to assign the value for a key "UK" to a constant name currency ...... Whenever i try change the value it everytimes ask me to defined let ukcurrency ....
Deepak Gaire
1,482 PointsDeepak Gaire
1,482 PointsIt really works man thanks a lot for your help ....... I appreciate it. Alot thanks