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 trialtalal alfaqeeh
419 PointsI could not solve it var_one = ['a', 'b', 'c', 'd', 'e', 't'] var_two = ['e'.index(-2)]
need some help with this last step
thank you var_one = ['a', 'b', 'c', 'd', 'e', 't'] var_two = ['e'.index(-2)]
var_one = ['a', 'b', 'c', 'd', 'e', 't']
var_two = ['e'.index(-2)]
3 Answers
Joel Price
13,711 PointsHeyo,
So this is asking you to create basically another list name var_two in which 'e' is at position -2. Which means 'e' should be on the second slot going from right to left. Something like this should do it:
var_one = ['a', 'b', 'c', 'd', 'e', 't']
var_two = ['f', 'e', 'g']
Give it a shot and see how it works for ya.
Jennifer Nordell
Treehouse TeacherHi there! You actually did sort of solve it already. It wants a string or a list such as the next to last element/character is an "e". But you did that in your original list. Simply copying the list in the first one and assigning it to var_two
would work. But since you already have it in place, you can do something even much simpler.
var_two = var_one
Hope this helps!
talal alfaqeeh
419 PointsThanks,
I thought that too, but it took me a while to understand it, English isn't my first language
Thanks a lot Jennifer
Joel Price
13,711 PointsJennifer Nordell Thank you! Didn't realize that a comment wasn't the same as an answer!
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherHi Joel Price! I took the liberty of making your comment an answer. This has a couple of benefits. First, it marks the question as answered on the forums. Secondly, it allows for voting on your answer and possible selection of "Best Answer". Thanks for helping out in the Community!
talal alfaqeeh
419 Pointstalal alfaqeeh
419 Pointsthanks you