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 trialeliasaidoukovitch
1,649 Pointsplease, what am I doing wrong? need help as quick as possible! Tnx
I don't know what I am doing wrong. I can't think of anything that I am doing wrong. Help me, please.
let world = [
"BEL": "Brussels",
"LIE": "Vaduz",
"BGR": "Sofia",
"USA": "Washington D.C.",
"MEX": "Mexico City",
"BRA": "Brasilia",
"IND": "New Delhi",
"VNM": "Hanoi"]
for n in world {
// Enter your code below
switch world {
case "BEL", "BGR", "LIE": europeanCapitals.append(n)
case "IND", "VNH": asianCapitals.append(n)
default: otherCapitals.append(n)
}
// End code
}
1 Answer
Greg Kaleka
39,021 PointsHi there,
It looks like you've changed the for loop from what was already in the challenge code. You want to leave this line intact:
for (key, value) in world {
The dictionary is made up of keys and values, so we have to address both. For example, the first item in the array has "BEL" as the key and "Belgium" as the value. The challenge is asking you to populate the arrays with just the country names (which are the values in the dictionary). So what you want to do is switch on the key from each item in the dictionary, and if it matches the right region, append the value to that region's array.
Give it another try and report back .
Cheers
-Greg