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 trialWarsame Warsame
4,241 Pointswhat is wrong my answer ?
var2 = "e" var2.index['-e']
var1 = ["a", "b", "c", "d", "e", "t"]
var2 = "e"
var2.index['-e']
7 Answers
Jeremy Hill
29,567 PointsHere is an example of what it is looking for:
var1 = "Shoutting"
var2 = "computer"
Warsame Warsame
4,241 Pointshow do I write the code? please
Jeremy Hill
29,567 PointsMy code is towards the top.
Wayne Jessen
11,593 PointsThe negative index starts as at -1 at the end of the list or string, from there it moves to the left.
Using lists:
var2 = [0,1,2,"e",4]
vae2 = ["B","B","B","B","B","B","B","e","B"]
Using strings:
var2 = bbbeb
var2 = bbbbbbbbbbbbbbbeb
Jeremy Hill
29,567 Pointsvar1 = "Shoutting" #the second 't' is the index 5
var2 = "computer" #the 'e' is -2 index
Warsame Warsame
4,241 Pointsthank you Jeremy Hill you'r the best
Jeremy Hill
29,567 PointsYou're welcome :)
Jeremy Hill
29,567 PointsJeremy Hill
29,567 PointsIn task 1 it was wanting a word that had the letter 't' in index 5 and in task 2 it wanted a word/iterable with the letter 'e' in the -2 index which basically equals the second to the last letter from the end.