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

aditya verma
aditya verma
1,853 Points

Incorrect answer, despite the correct display of expected output

The correct output is displayed, yet there is some error; answer is incorrect

continents.py
continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
# Your code here
for i in continents:
    if i=='Asia':
        print('* ',i)
    if i=='South America':
        print('* ',i)
Richard Verbraak
Richard Verbraak
7,739 Points

It says to print out EACH continent looking like:

  • Continent
  • Continent Etc.

You had the right idea but you need to iterate over every continent and print them out.

for i in continents:
  print("* ", i)

4 Answers

print('* ',i) with a comma adds a space so you'd have two spaces between your bullet and continent name.

try:

print('*',i)

aditya verma
aditya verma
1,853 Points

Thank you! The space after the asterisk '* ' made the comma redundant. It worked after removing the space.

The task asks you to: Print a bulleted list of each continent

The 'Output should look similar to' is just an example not a complete list

aditya verma
aditya verma
1,853 Points

Thank you for your prompt response! I did that the first time and it displayed the list with an asterisk and yet it was incorrect :-( i dont have the screenshot though

this is what is wrote for i in continents: print('* ',i)

Response: Bummer: AssertionError: '* Asia' not found in '* Asia\n* South America\n* North America\n* Africa\n* Europe\n* Antarctica\n* Australia' : Hmm...not finding the correct items in your output.

I dont know why the \n is a problem

Steven Parker
Steven Parker
231,248 Points

I'm assuming you're working on task 2, the other answers given here would cover task 1.

There are several continents that begin with the letter "A" that this code does not print, plus it prints one that starts with "S". But the challenge doesn't want you to check for individual names anyway.

Instead, use indexing (with []'s) to select the first letter from each name and test if it is "A".

Also, you won't need a space with your asterisk when you give it as a separate argument using a comma, since that adds a space for you (but the space would be handy if you were concatenating with "+" instead).

Richard Verbraak
Richard Verbraak
7,739 Points

Try print("i " + i)

If this doesn't work go back to the video tutorial and copy their way of iterating over a list. You have the answer and you know how it works but unfortunately, you need to be 100% correct according to their intended style for you to complete the challenge.