Advanced Topics in Python_Practice Makes Perfect


What is wrong??

File "python", line 3
middle_third = to_21 range(7:14)
SyntaxError: invalid syntax

to_21= [i in range(22)]
odds= [to_21 for to_21 in range(21) if i % 2 == 1]
middle_third = to_21 range(7:14)


Recall that you already have an object, to_21 that contains a list. The only thing to consider is whether or not is should contain a zero.

The odds in that list are,

[x for x in to_21 if ... ]


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