Python‎ > ‎operator‎ > ‎

operator.le()

http://www.adilwaseem.com/

Defintion
The method returns whether the a small or equal to b.

Syntax
le(...)
le(a, b) -- Same as a<=b.

Parameters
Number

Examples
The operator returns with:
 >>> a=4
>>> b=3
>>> import operator
>>> operator.le(a,b)
False

operator.__le__(a,b)
Same results:
 >>> a=4
>>> b=3
>>> operator.__le__(a,b)
False

a<=b
The return same value.
 >>> a=4
>>> b=3
>>> a<=b
False

operator.le(math.asin(),math.atan())
The method returns after dividing the asin() with atan().
 >>> import math
>>> import operator
>>> a=math.asin(.11)
>>> b=math.atan(.91)
>>> operator.le(a,b)
True
>>> operator.__le__(a,b)
True
>>>

__le__
The return is:
import operator
import random
a=float(random.randrange(1,10))
b=float(random.randint(20,40))
c=operator.pow(a,b)
if c.__le__(10):
    print("Random value: ",c+5)
elif c.__ge__(20):
    print("Random value: ",c-5)




Comments