Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.