python how to generate random number code example
Example 1: random number python
# generate random integer values
from random import randint
value = randint(0, 10)
print(value)
Example 2: python random number
from random import randint
print(randint(1,3))
#Possible Outputs#
#1
#2
#3
Example 3: generate random number python
import random
random.randint(lower, upper)
Example 4: random numbers in python
import random
randomNumber = random.randint(1, 100)
print(randomNumber)
Example 5: random number python
import random
num = random.randint(1, 10) # put any number
print(num)
Example 6: random in python
print(random.randint(1, 100))
print(random.random())