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 trialSundas Arshad
460 PointsWhy am I keep getting error that south america is in my output list, when I am indexing 0,3,5,6.
South America is at index 2
continents = [
'Asia',
'South America',
'North America',
'Africa',
'Europe',
'Antarctica',
'Australia',
]
# Your code here
print("Continents:")
for continent in continents:
print("*", continent)
print(continents[0])
print(continents[3])
print(continents[5])
print(continents[6])
2 Answers
Steven Parker
231,275 PointsYour loop still prints all the continents (including South America) before getting to the added lines.
But what the challenge is actually asking you to do is to continue using the loop, but modify it to check the first letter of each item and decide whether to print it or not based on what it contains.
Hint: You can do this by adding just one line to the code that passed task 1.
David Garcia
Python Development Techdegree Graduate 11,254 PointsYou are close to figuring this out. All you have to do is get rid of all the print statements out side of the for loop including the one before the for loop. The question wants you to use a for loop that's going through the list of continents all you have to do is add the star symbol before continent in your print statement. in other words you got it right just get rid of the print statements outside the for loop