Python‎ > ‎operator‎ > ‎

operator.truth()

http://www.adilwaseem.com/

Definition
The method return True if the argument is True or another case returns false.

Syntax
operator.truth()

Parameters
object

Examples
Return with maximum and minimum degrees values:
import math
import operator

a=math.degrees(33)
b=math.degrees(22)
c=math.degrees(34)
d=math.degrees(13.1)
e=math.degrees(120)

tuple=(a,b,c,d,e)

g=min(tuple)
h=max(tuple)

if operator.truth(abs(g-h)>90):
    print("Minimum degrees value is: ", g)
    print("Maximum degrees value is: ", h)
    print("The difference between minimum and maximum degrees is less 90 Degrees which is: ", abs(g-h))
else:
    print("The difference between minimum and maximum degrees is less 90 Degree which is: ", abs(g-h))

>>> 
Minimum degrees value is:  750.5747116213784
Maximum degrees value is:  6875.493541569878
The difference between minimum and maximum degrees is less 90 Degree which is:  6124.9188299484995
>>> 


Comments