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

Marek Ostrowski
Marek Ostrowski
16,122 Points

printg 2 fisr arguments from list using for in statement

Hi I have stucked in continents.py

I can not modify continents list I have to print only 2 first arguments using for in statement

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

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

1 Answer

If by first two arguments you referring to:

Output should look similar to:

  • Asia
  • South America

the first task wants you to print all continents. You are close but by including a space and comma in your print function you will end up with two spaces between the bullet and the continent name.

This:

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

should be:

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

Using the comma will add the needed single space

Marek Ostrowski
Marek Ostrowski
16,122 Points

Thank you, for quick response that worked!