Comparison operators โ
The comparison operators ==
, !=
, <
, <=
, >
, >=
behave just like in python.
Equal โ
expr1 == expr2
Return True
if expr1
is equal to expr2
, False
otherwise.
Not equal โ
expr1 != expr2
Return True
if expr1
is not equal to expr2
, False
otherwise.
Less than โ
expr1 < expr2
Return True
if expr1
is less than expr2
, False
otherwise.
Less than or equal โ
expr1 <= expr2
Return True
if expr1
is less than or equal to expr2
, False
otherwise.
Greater than โ
expr1 > expr2
Return True
if expr1
is greater than expr2
, False
otherwise.
Greater than or equal โ
expr1 >= expr2
Return True
if expr1
is greater than or equal to expr2
, False
otherwise.
Compare โ
sp.compare(<expr1>,ย <expr2>)
Return 0
if expr1
and expr2
are equal, 1
if expr1
is greater, -1
otherwise.
Operations โ
Get the minimum of two values โ
sp.min(expr1, expr2)
Return the minimum of expr1
and expr2
.
Example โ
sp.min(10, 11) # 10
Get the maximum of two values โ
sp.max(expr1, expr2)
Return the maximum of expr1
and expr2
.
Example โ
sp.max(10, 11) # 11