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 trial

Python Introducing Lists Using Lists Continental

Please can you help me? Invalid synthax

I would like to know my synthax and/or code error

continents.py
print("continents:")
for Asia in continents:
    print("* " + Asia)
    for South America in continents
    print("* " + South America)

3 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Valeria;

The challenge here in Task 1 is to just print out the bulleted list of continent names. As such, your first line that is printing all of the continents isn't needed.

For your forloop, you don't need the second for statement there and using something like "South America" in there is causing some syntax issues due to a space in that name.

That being said, using "Asia" as the iterable name will work, but is kind of wonky. Recall that a for loop iterates over the members of the sequence (the continents list), in order, and then executes the block of code each time. It would probably be more common, in this case, to have the for statement read:

for continent in continents:

In that code block then you can put the print() statement and the for loop will print it out for each item in the continents list.

Post back if you're still stuck.

Happy coding!
Ken

Thanks Ken! Finally solved and carried on ;)

Hey Ken, I would like to know my error code. For the first assignment of writing bulleted names of continents: Here are my code. Is generating AssertionError. for continent in continents: print("*" + continent)

Where am I doing wrong?

Ken Alger
Ken Alger
Treehouse Teacher

It looks like you are missing the space between the asterisk and the continent name. Add that to your string and you should be all set.