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 Python Basics (2015) Python Data Types Specific Index value

Let's practice with index Make a new variable named var_one that is either a list or a string. Make sure that var_on

i dont get it

index.py
var_one.index["t"]

1 Answer

Hi Stewart,

Please note the question here is to create a new variable by name var_one and the variable can be either list or string.

For example, I am creating a variable named var_one which is the list which contains items :

var_one = ['a', 'b'', 'c', 'd', 'e', 't']

if you want to look for any item from the list, you can refer it as below:

var_one[0] will be 'a', var_one[1] will be 'b', similarly var_one[5] = 't'

Hope this helps.