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 trialDavid Saucedo
Front End Web Development Techdegree Student 2,384 PointsChallenge question help
Can someone please tell me why this code isn't working for this challenge?
continents = [
'Asia',
'South America',
'North America',
'Africa',
'Europe',
'Antarctica',
'Australia',
]
# Your code here
for continent in continents:
print('* ' + continent)
for continent in continents:
if continent[0] == "A":
print(continent)
1 Answer
Louise St. Germain
19,424 PointsHi David,
You're very close! For the second part of the challenge you'll need to update the code you had for the first part of the challenge, instead of creating a second for loop. It's asking to only see only a single list containing the continents that start with "A", but the way your code is above, it lists all the continents (still), and then outputs a second list with the A-continents.
Also, in the output for the A-continents, you don't have the "* " bullet points that it's expecting.
So basically you just need to set the print statement on the last line to include the "* " (exactly like you did it for part 1 of the challenge), and then get rid of your first for loop entirely, so that it only prints out the A-continents.
Once you do that, everything should be working for part 2 of the challenge.
I hope this helps!
David Saucedo
Front End Web Development Techdegree Student 2,384 PointsDavid Saucedo
Front End Web Development Techdegree Student 2,384 PointsWow! Silly me, thanks so much!! You saved me from buying another keyboard haha
Louise St. Germain
19,424 PointsLouise St. Germain
19,424 PointsHaha! Glad to hear I saved you some keyboard shopping. :-D Happy programming!