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

Python Basics Code Challenge

Let's practice with indexes! Make a new variable named var1 that is either a list or a string. Make sure that var1[5], the item with an index value of 5, is the letter "t".

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

7 Answers

Sandeep Krishnan
Sandeep Krishnan
9,730 Points

what's wrong with varl = "abcdet" This also a string

Jeffery Austin
Jeffery Austin
8,128 Points

Nothing wrong with that. You can use a string or a list. All that matters is that "t" is at the index of 5.

Jeffery Austin
Jeffery Austin
8,128 Points

What you want to do is create a string or list that has 't' at the index of 5. Remember that all indexes start at 0.

Thanks Jeff. I thought it was the letter 'l' LOL

Jeffery Austin
Jeffery Austin
8,128 Points

No worries, it actually does look like the letter 'l'. It's hard to tell.

Thanks Jeffery. Here's my code. I'm getting a syntax error

varl = ["a", "b", "c", "d", "e", "t"] varl = [ 0 1 2 3 4 5 ]

Jeffery Austin
Jeffery Austin
8,128 Points

You had it right, just missed the naming of the variable, you need var1, like var and the number one '1'

var1 = ["a", "b", "c", "d", "e", "t"] 

Straight to the point Thank you so much

Aurelie Sacoman
Aurelie Sacoman
723 Points

Nathan Williams Jeffrey Austin Same mistake as you! I thought it was the letter "l" ! Working now, thanks guys!