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

Arjan Guglani
Arjan Guglani
3,598 Points

This is very confusing, how does it work

How does this work

index.py
var_one = 'weryet'
var_one[5]
'er'= var_two = 'tyrererer' 

1 Answer

Omar Farag
Omar Farag
4,573 Points

The challenge asks for you to make the index[5] of var_one = 't'. You did this correctly. It then asks you to make the index[-2] of var_to = 'e'. Since negative index's start at the end, index[-1] would be the last letter in the string.

var_one = 'accent'
var_two = 'et'

As you can see, the 5th index is 't' in var_one, and the -2 index is 'e' in var_two. Also, the challenge does not ask for you to add the index box thingy