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

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

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!