Practice Makes Perfect


Here's my code. I can see what it's 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


What's at index 7 and 14?


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

Thank you, ionatan, for being gentle.


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