List Slicing Syntax


#1



I'm not stuck on this, I'm just confused about the lesson. We're told that the "start" for [start:end:stride] is inclusive, yet in the lesson the numbers returned start at 9. If it's inclusive, shouldn't 4 be the first number returned?


Replace this line with your code. 
l = [i ** 2 for i in range(1, 11)]
# Should be [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]

print l[2:9:2]


#2

The output is [9, 25, 49, 81], for the record.


#3

no, lists are zero indexes based. so the first item is at index 0, not 1.

look:

print l[0]  # 1
print l[1] # 4
print l[2]  # 9

#4

Gotcha. So it's using indexes. That's where I was getting confused. Appreciate it!


#5