Sgn function in Python

One-line sign function of a real number.

In Python a boolean variable is subclass of integer taking two values, 0 for False and 1 for True. Also, every boolean expression returns the value of last evaluated argument.


References: