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 trialAkua Agyeman
532 Pointsindex 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...
##var1='redout'
##var1.index('t')
var2='treed'
var2 [-2]
3 Answers
prateekmahesh
5,454 PointsSee 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'
prateekmahesh
5,454 PointsTell me if this works or we might have to try something else
Akua Agyeman
532 Pointsdidnt 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.
prateekmahesh
5,454 PointsIf 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.
Akua Agyeman
532 PointsGreat thx.
prateekmahesh
5,454 Pointsprateekmahesh
5,454 PointsMoreover, 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