Python Introducing Lists Using Lists Continental

Caleb Newell
Caleb Newell
3,014 Points

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
27,990 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.

Caleb Newell
Caleb Newell
3,014 Points

Thanks for the help every one! Much Thanks :)