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

Chris Bennett
Chris Bennett
1,328 Points

Negative Index?

Not understanding the concept of how to create a list with a negative index?

index.py
var_one = ('o','p','q','r','s','t')

2 Answers

Andrey Misikhin
Andrey Misikhin
16,529 Points

List must be the same, you only need to start count from rigth side: -1 - t, -2 - s, etc.

Chris Bennett
Chris Bennett
1,328 Points

So if it wants 'e' to be negative than I would just do '-2 -e', '-1 -f', '0 g', etc?

Andrey Misikhin
Andrey Misikhin
16,529 Points

You must put 'e' in -2 index, this means, that 'e' must be second item if you count from rigth.

var_one = ('o','p','q','r','e','t')