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

zoltans
zoltans
2,547 Points

I have stuck with printing out countries beginning with "A". Please, help!

I have no idea how to the second task. I have rewatched Craig's videos, just in case I have missed something. but couldn't find a way to solve this task.

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

5 Answers

The assertion error states : '* Asia' not found in 'Asia' . You are missing the bullet.

Efaz Khan
Efaz Khan
5,194 Points

Hi @zoltans , you can use a for loop to iterate through the list and check if the first letter starts with 'A'. First letter of a word can be accessed by cont[0]

continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
# Your code here
for cont in continents:
    if cont[0] == 'A':
      print(cont)
Efaz Khan
Efaz Khan
5,194 Points

This code should work

continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
# Your code here
for cont in continents:
    if cont[0] == "A":
        print("* " + cont)
zoltans
zoltans
2,547 Points

Bummer: AssertionError: '* Asia' not found in 'Asia\nAfrica\nAntarctica\nAustralia' : Hmm...not finding the correct items in your output It still isn't giving me the pass. Do you know why?

continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
# Your code here
for cont in continents:
    if cont[0] == "A":
        print(cont)
zoltans
zoltans
2,547 Points

Thanks a lot you guys!