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

Marek Ostrowski
Marek Ostrowski
11,726 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
11,726 Points

Thank you, for quick response that worked!