Python Introducing Lists Using Lists Continental

Matt Fuller
Matt Fuller
2,138 Points

introducing lists - Challenge Task 2 of 2 - python

Any help completing this one would be greatly appreciated. Still a total coding noob, attempting to memorise the basic terminology but failing miserably.

continents.py
continents = [
    'Asia',
    'South America',
    'North America',
    'Africa',
    'Europe',
    'Antarctica',
    'Australia',
]
print("{}".format(continents[0]))
print("continents:") 
for a in continents:
    a = a.lower()
    print("* " + continents)

2 Answers

Steven Parker
Steven Parker
182,024 Points

You're getting close, but:

  • you don't need to "print" anything before the loop
  • the "print" inside the loop should use the individual item (a) instead of the whole list
  • you don't need to change the case of the item
Matt Fuller
Matt Fuller
2,138 Points

I'm sorry, I still don't understand =(].

So I can remove the a = a.lower()?

And which print isn't required? Everything below "print("{}".format(continents[0]))" ?

Steven Parker
Steven Parker
182,024 Points

Yes, you should remove the "a = a.lower()", and the two "print" lines above the loop.

And the last "print" should use the individual "a" instead of "continents".

Matt Fuller
Matt Fuller
2,138 Points

Ah... nope, I thought I had it. so my code is now:

continents = [ 'Asia', 'South America', 'North America', 'Africa', 'Europe', 'Antarctica', 'Australia', ] for a in continents: print("* " + a)

But how do I make it so that It's testing the first character to see if it starts with A? surely this is just seeing if there is an A in the entire place name?

Steven Parker
Steven Parker
182,024 Points
    if a[0] == "A":    # test if the first character (index 0) is "A"
Matt Fuller
Matt Fuller
2,138 Points

Ah, I get it... Thank you again!