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! While you're at it, check out some resources Treehouse students have shared here.

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

Python Introducing Lists Using Lists Continental

how to access characters in a string by index

i need access "A" in my list and find the words beginning from the "A"

2 Answers

Podrig Leoghain
Podrig Leoghain
5,094 Points

You reference the index of the list item by using square brackets, e.g.

if foovar[0] == "A"

Hope this helps!

thank you!!! then how can i find the words in the list beginning from A and print it out?

Podrig Leoghain
Podrig Leoghain
5,094 Points
for continent in continents:
    if continent[0] == "A":
        print("*", continent)

I would recommend you go back over the videos leading up to this challenge as it gets way harder after this one. If you haven't got the idea of simple iteration and print statements then you'll be completely at a loss further down the line.

thank you for your help.i'll check videos again

Podrig Leoghain
Podrig Leoghain
5,094 Points

No problem. If you need any more help please just ask.