A common situation: checking that the variable is within the given limits. You could use the logical operator and:
if x> = 5 and x <20:
However, Python provides us with a syntactic convenience that looks more "mathematical." Such a record is both shorter and more understandable:
As a comparison operators in chains, any of the list in any combinations can be:
"<", "==", "> =", "<=", "! =", "is" ["not"], ["not"] "in"
Those. The recording of the type A C is quite legal, although it is difficult to understand.
Formally, if we have n operations OP1 ... OPN and N + 1 expressions (A, B ... Y, Z), then the recording of the type:
OP1 B OP2 C ... Y OPN Z
These are equivalent records:
OP1 B and B OP2 c and ... and y opn z
Print (1 Print (X <10 Print (10> x <= 9) a, b, c, d, e, f = 0, 5, 12, 0, 15, 15 Print (a <= b #machinelearning #artificialintelligence #ai #datascience #programming #Deechnology #Deeuplearning #bigData #bigdata