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

Cannot figure out the way to print out the words starting with the same letter

I can't figure it out! I have tried pop and continents = ['Asia', 'South America', 'North America', 'Africa', 'Europe', 'Antarctica', 'Australia'] for c in continents: print("* " + c[0,3,5,6]) i just keep getting a "string indices must be integers" i don't know what else to try. i might just be over complicating things, once someone replies with an answer i know ill be mad at myself for it being so easy

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

1 Answer

You are already looping through each of those continents in your for loop, so you don't need to list out all of the indeces in pop. For example, if you want to print all of the characters in this list:

my_list = ['a','b','c','d','e']
for item in my_list:
    print('* {}'.format(item))

use this same logic to print all of the continents. Remember, \n is used to move to the next line.