Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
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.