Because it is for (i in range(1,10))not syntactically correct.
Suppose that he (i in range(1,10))understood anyway, he would return a logical value. So you are trying to say for Trueor for False, and boolean cannot be repeated, and this is not valid syntax.
The reason your other examples work is because they expect a boolean value that is returned from 1 == 2andi < 10
source
share