Welcome to the Treehouse Community
Looking to learn something new?
Farhan Murad1,920 Points
Intro to List
I have to print continents beginning with the letter "A". Can someone help me do that?
continents = [ 'Asia', 'South America', 'North America', 'Africa', 'Europe', 'Antarctica', 'Australia', ] # Your code here print("Continents:") for continent in continents: print("* " + continent)
Chris FreemanTreehouse Moderator 67,989 Points
Hint: Given that in each loop,
continent contains the string name:
- The first character of some
stringcan be reference using
- The method
string.startswith()returns a Boolean if the argument matches the beginning of the string
if statement that uses one of the above comparisons and prints only conditions are correct.
Post back if you need more help. Good luck!!