Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Sundas Arshad460 Points
Why 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) print(continents) print(continents) print(continents)
Steven Parker222,336 Points
Your 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 GarciaPython Development Techdegree Graduate 11,254 Points
You 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