Practice Makes Perfect


#1



Here's my code. I can see what it's doing...to a point. My understanding is that "start" is inclusive and "end" is exclusive. If that is true, wouldn't I print the 7 and not print the 14? Here's what I do print:
[8, 9, 10, 11, 12, 13, 14]


to_21 = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]
odds = to_21[::2]
middle_third = to_21[7:14:1]
print middle_third


#2

What's at index 7 and 14?


#3

What an idiot! I should have known that since I've programmed in other languages for decades.

Thank you, ionatan, for being gentle.


#4

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