Python‎ > ‎random‎ > ‎

random.randint()


Introduction
The randint(a, b) method of random.Random instance Return random integer in range [a, b]

Syntax
random.randint(a,b)-> random number within specified limit

Parameters
a=starting limit
b=upper limit

Example
import random
x=random.randint(12,200)
print(x)

>>> 
133
>>>

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