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 trialjohn larson
16,594 Points@3:56 in the video Kenneth gets a descending list...I do not
# when Kenneth does this
# he gets a descending list from 7 to 2
# I get the number 6
my_list = list(range(20))
x = my_list[7-1]
print(x)
1 Answer
jacinator
11,936 PointsSomething is wrong with the video display or rendering I think. When you enter my_list[7-1] Python takes the math operand -
and does 7 - 1
. This means that what you are really doing is my_list[6]
which will return 6
.
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsYeah, something might have went wrong with the video editing.
It probably should be showing
Clayton Dobbs
1,917 PointsClayton Dobbs
1,917 PointsYeah, as soon as I saw that, I had to attempt as well. Like jacinator , I received
6
as well.