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

Whats wrong with my code?

Help

continents.py
continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
# Your code here
for continent in continents:
    print("* " + continent)
    if continent[0] == 'A':
        print("* "+continent)

1 Answer

Hi if I remember correctly the challenge does not require you to print the results of the continents before checking if they have "A" as the first character. So your code is correct you are just adding in a line not required by the challenge. Your final code should be:

for continent in continents:
    # print(f"* {continent}\n")
    if continent[0] == "A":
        print(f"* {continent}\n")

The challenge is not very clear that you should remove the first part of the challenge from the second. Also if you are wondering what the 'f' is before my strings - I am not using .format and am instead feeding the variable directly into the string - this is called "f-strings" but don't worry about those, they are correct.