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.

Python Introducing Lists Using Lists Continental

AssertionError in code challenge (for...in iteration through list

Hi,

here the question I have trouble with:

'Print a bulleted list of each continent from the continents list.

Output should look similar to:

  • Asia
  • South America'

Here the respective list:

continents = ['Asia', 'South America', 'North America', 'Africa', 'Europe', 'Antarctica', 'Australia']

Here my answer:

continents = ['Asia', 'South America', 'North America', 'Africa', 'Europe', 'Antarctica', 'Australia'] for continent in continents: print("* " + continent)

Error Message:

'Bummer: AssertionError: '* Asia' not found in 'Asia\nSouth America\nNorth America\nAfrica\nEurope\nAntarctica\nAustralia' : Hmm...not finding the correct items in your output'

My logic seems fine, how come that 'continent' can't be set to 'Asia' (or any other item in the list) ?

Thanks!

continents.py
continents = ['Asia', 'South America', 'North America', 'Africa', 'Europe', 'Antarctica', 'Australia']
for continent in continents:
    print(continent)

2 Answers

Hi Adam,

apologies for the confusion, the following was my answer yesterday/is my answer today:

'continents = ['Asia', 'South America', 'North America', 'Africa', 'Europe', 'Antarctica', 'Australia'] for continent in continents: print("* " + continent)'

For some reason, today no error message...? The error seems to have been on TH side, is resolved - thanks for the quick reply Adam!:)

Franz

np! You can mark this question as solved by choosing a "best answer". :smile:

Are you putting an asterisk in front of each continent?

Your post has two sets of code, and I'm not sure which one you consider your answer here.