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

TabError

every time i load this code it replies: TabError: inconsitant use of tabs and spaces. A little help here please.

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

2 Answers

Mustafa Başaran
Mustafa Başaran
28,046 Points

Hi Caleb,

You only need 3 lines of code in the second step: Loop through each element of the list. If the first character of the element is A, then print that element out in the special format.

Below code snippet exactly does this.

for c in continents:
    if c[0] == 'A':
        print("* {}".format(c))

(In the loop you have typed above, you are actually printing everything twice.)

I hope this helps.

Thanks for the help every one! Much Thanks :)