Python Introducing Lists Using Lists Continental

I can't get the challenge to pass even though I've done what was asked I'm not sure what is wrong.


It states to print out the continents that begin with a which I've done. But does not pass. PS the one I'm having a problem with is the 2nd challenge that you must print out a continent that starts with A.

Thanks Christian
continents = [
    'South America',
    'North America',
# Your code here

for i in continents:
    print(f"* {i}")
        if i[0] == "A":
            print(f"* {i} begins with the letter A"
Michael Cook
Michael Cook
16,269 Points

Prepare for a lot of frustration. The python challenges are buggy and IMHO the instructor is even worse. I eventually just stopped taking python courses on Treehouse and started learning PHP instead. More web jobs in it anyway.

2 Answers

Pro Student 49,924 Points

For task 2 you should only have one print statement. And that should just print the bullet and continent. Otherwise you are on the right track.

Oh okay that for it to pass it must be the bullet + continent. Thank you

Manuel Canario
Manuel Canario
624 Points

I'm kind of lost: We haven't discussed any "f" as a function so far. This is what I have but it keeps nagging me about indentation.

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

Your code here

for continent in continents: if continent(0) == 'A': print("* "+ continent)

Hi Manuel

Sorry for the late reply, the f in front of the string is a trick I picked up on my past years of journeying through python. It basically is just telling the string it will be formatted (ie: print("The {} dog runs!".format(dog_color)) => print(f"The {dog_color} dog runs!")). The challenge could be worded better it's a little confusing the output it wants is this:

  • Asia
  • Africa
  • Antarctica
  • Australia