Answer the question
In order to leave comments, you need to log in
How does the or variator work in Python?
Good afternoon.
A small question.
Why this doesn't work: elif int(step_id) == 3 or 4:
But this works:elif int(step_id) == 3 or int(step_id) == 4:
Answer the question
In order to leave comments, you need to log in
The first option is not correct from the point of view of logical operations. And you will always have True.
For example step_id = 2:
For example step_id = 3:
For example step_id = 6:
And the second option is correct.
For example step_id = 2:
For example step_id = 3:
In order to understand how execution happens, you need to read about execution precedence .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question