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

George Gregorczyk
George Gregorczyk
3,028 Points

How to solve this excercise?

I do not understand why I am getting 2 errors and I have no other idea how to solve this code. I'm sorry it's my 9th day of learning to code in python and I am getting frustrated over this one excercise.

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

1 Answer

I'm assuming that you are on the second task

It seems that you are a bit lost. Why are you passing in continents[0, 3, 5, 6] into format?

Solution:

  • Go through each continent. (Well, you are already doing that.)
  • On each iteration of the loop, check if the first letter of the continent is 'A'.
  • If it is, print out the continent.
George Gregorczyk
George Gregorczyk
3,028 Points

I understand now but I don't know what code to use in order to check if the letter of the continent is 'A'. I tried to use del in order to delete those who don't begin with 'A' but I got some errors.