Python Introducing Lists Using Lists Continental

Jenna Var
Jenna Var
3,062 Points

Code works in my IDE but failed in Challenge

Hi all,

I run into this error when I check my work in challenge:

Bummer: AssertionError: '* Asia' not found in 'Asia\nAfrica\nAntarctica\nAustralia' : Hmm...not finding the correct items in your output

However, when I copy and paste my code into my IDE(Pycharm), it works just fine. Does anyone else runs into the same issue? TIA!

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

4 Answers

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 50,905 Points

This passes both tasks

continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
for continent in continents:
    if "A" in continent[0]:
        print("*", continent)

I pasted your updated code in and it passed both tasks as well

KRIS NIKOLAISEN
PRO
KRIS NIKOLAISEN
Pro Student 50,905 Points

I haven't seen that solution before. For task 2 you also need to print a bulleted list. This is what is meant by '* Asia' not found in 'Asia'

Jenna Var
Jenna Var
3,062 Points

Hmm...would you mind posting here what your solution was? For challenge 2 to print out bullet points, here is what my code will be. it also works fine in Pycharm:

continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
for continent in continents:
    if "A" in continent[0]:
        print(f"* {continent}")          

here is the outcome in Pycharm:

* Asia
* Africa
* Antarctica
* Australia
Jenna Var
Jenna Var
3,062 Points

Much appreciated, thank you! on a side note, I just love f-string so much that I keep using it everywhere even when it's simpler not to, LOL.