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

Recalling one than one item from a list at a time.

Trying to print all the continents that start with A, but when i do i get TypeError: list indices must be integers or slices, not tuple. So then i tried to print each one at a time ex: print(places[0]) print(places[3]) print(places[5]) print(places[6]) but still says its wrong. feel like i'm missing some small detail, but not sure.

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

3 Answers

for places in continents:
    if 'A' in places[0]:
         print("*" + places)

Good luck :)

check the first index of the string. if it starts with the letter "A" print it.

If you don't get it just reply. and I'll help you out a little more.

i got it now after i took away from of the [0]. What i was trying was if places[0][0] == 'A': print("* " + places)

Thought [0][0] was looking the the first thing in list followed by first letter, but found out it was just [0].

Thought if i did just (Example: places[0]) it would just look at 'Asia' as a whole and not see the 'A'