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!
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
I am having trouble calling the list "A" list items in this challenge.
I've tried [0, 3, 5, 6] in different methods, including creating a new list and calling that. I'm genuinely stuck on this portion and can't find any clarification in the video for calling list items by character. Much appreciated!
continents = [ 'Asia', 'South America', 'North America', 'Africa', 'Europe', 'Antarctica', 'Australia', ] for c in continents : print("* " + c)
To get the first letter of the string
c, you could use
c. You could then compare the first letter to 'A'.
Another way would be to use the
startswith method on your string, such as
s.startswith('A') which will give you either true or false.
for c in continents :
if c == "A" print("* " + c) I'm getting syntax error on what I thought would make total sense. Any help here with layout of proper syntax would be much appreciated, this is the first challenge that's left me stuck and i've been thinking on it since yesterday. I may not be built for this, haha.