Why is "middle_third = [start : end]" not right?


#1



File "python", line 8
middle_third = [start : end]
^
SyntaxError: invalid syntax


to_21 = range(1,22)
#print to_21

odds = to_21[::2]
#print len(to_21)/3, 2*len(to_21)/3
start = len(to_21)/3
end =2*len(to_21)/3
middle_third = [start : end]


#2

because the start and stop value should be integers? start and stop are just terms we use for general syntax


#3

I found "middle_third = to_21[start : end]"
I was stupid


#4

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