11. Practice Makes Perfect


#1


to_21 = range(1, 22)
odds = to_21[::2]
middle_third = to_21[8:15]

print to_21
print odds
print middle_third

The middle third accepts[7:14] as the correct answer and not [8:15]?
How is this possible when the slicing rule suggests that starting number of the range is inclusive and the last one is exclusive?


Replace this line with your code.


#2

because lists are zero index based? in other words, counting start at zero, not at 1


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.