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 trialRonald Greer
Front End Web Development Techdegree Graduate 56,430 PointsWhat's going on with my code?
i am on task 1/1 and i keep getting errors for stuff i have done
continents = [
'Asia',
'South America',
'North America',
'Africa',
'Europe',
'Antarctica',
'Australia',
]
# Your code here
print("continents:")
for continents in continents:
print("* " + continents)
1 Answer
Steven Parker
231,248 PointsYou didn't say what errors you are getting, but at first glance I noticed this:
for continents in continents:
You can't use the same variable name for both the loop variable and the iterable.
Ronald Greer
Front End Web Development Techdegree Graduate 56,430 Pointswhat should i put as the iterable then?
Steven Parker
231,248 PointsThe iterable is correct, you just need to pick a different name for the loop variable (any name of your choice).
Ronald Greer
Front End Web Development Techdegree Graduate 56,430 Pointsok I'll try that and let you know how it goes
Steven Parker
231,248 PointsThe iterable is the one that comes last, and it was correct before when it referenced the list. It's the loop variable (the first one) that needs a different name.
Ronald Greer
Front End Web Development Techdegree Graduate 56,430 PointsRonald Greer
Front End Web Development Techdegree Graduate 56,430 Pointsokay so now it says i have two problems in my code. i changed my code to: print("continents:") for continents in continent: print("* " + continents)