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

index problem. task 2 isnt passing. dont know why.

Task one worked fine- line 1: var1-'redout', line 2: var1.index('t') passed.
Task 2/ line 1: var2=treed, line 2: var2.index [-2] should return a value e but isnt working. Keeps taking me back to task one which has already passed and telling me Task one not passing...

var2 [-2]

Moreover, your variable anyway has 't' at index5 So why do you want it to be returned. The task does not require that piece of code

3 Answers

See the task just wants you to define 2 variables var1 and var2 and not return anything. So you code should look like this:

var1 = 'redout'
var2 = 'tuoder'

Tell me if this works or we might have to try something else

didnt work. I have to create a var2 with letter 2 at index -2 and then try to get it to return that value. Given my code, it should return e when i ask it for var2[-2], but it isnt.

If you carefully read what the instructions say. You will get it. The task only wants you define two variables var1 and var2. It does not mention any where that you must have that value returned. Try this one more time. If it continues to throw an error then you can send an e-mail to the Support team regarding your issue.

Great thx.