Python Introducing Lists Using Lists Continental

Ben Lavallee
Ben Lavallee
935 Points

Printing strings that only start with a specific letter : Assertion Error

I am working through the track "Introducing Lists" and I am having an error that I am not sure about. It appears that the check work function is showing that the goal, which is to print the continents only that being with the letter A, is working fine, however I am getting the below assertion error.

I don't think assertion errors have been discussed to this point in the course, so I wasn't sure what to make of it. This is the full code that I am using, and below is the error I am receiving. Before printing the error, the code does print Asia, Africa, Antarctica and Australia.

Ran 1 test in 0.000s

OK

.F

FAIL: test_output (main.TestIterationExecution)

Traceback (most recent call last): File "", line 49, in test_output AssertionError: '* Asia' not found in 'continents:\nAsia\nAfrica\nAntarctica\nAustralia' : Hmm...not finding the correct items in your output


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

print('continents:')
for continent in continents:
    first_letter = continent[0]
    if first_letter == 'A':
        print(continent)

1 Answer

Pedro Cabral
Pedro Cabral
19,125 Points

You are still meant to output as per task1 format, with an asterisk and a space before the continent.

Ben Lavallee
Ben Lavallee
935 Points

Thanks for noticing that, just added the * to my code and it ran fine!