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

Carole Cox
Carole Cox
429 Points

I can't get past varl not being defined. it looks like I am following the lecture to the "t".

It looks like I am not getting the challenge question again. I am going back and forth with the lecture-this looks right....but :-(

index.py
varl = "smart"
varl.index('t')

2 Answers

Rick Buffington
Rick Buffington
8,146 Points

You are super close. All they are looking for is a variable named var1 being assigned a string where var1[5] is the letter "t". Where you are a smidgen off is your index start point. Remember, the indexes on strings and arrays start at 0. So, if they want your var1[5] to be "t", that means it would be 0, 1, 2, 3, 4, [5] - the 6th character in the string. Add 1 more letter before the "t" and you will be golden! You do not need the var1.index piece - only declaring var1 is required.

Carole Cox
Carole Cox
429 Points

Oh my! How "duh" of me. I also saw another mistake that was creating the defined issue. the type in the challenge mad var1 look like varl. I was using varl which the challenge would not see! Once I saw your help, I saw another problem. Finally a pass!. Thanks Rick!

Rick Buffington
Rick Buffington
8,146 Points

No problem. Glad I could help.