SyntaxFix
Write A Post
Hire A Developer
Questions
Operator precedence in python You can see that not X has higher precedence than and. Which means that the not only apply to the first part (u0 <= u). Write:
not X
and
not
(u0 <= u)
if not (u0 <= u and u < u0+step):
or even
if not (u0 <= u < u0+step):