choose random number python code example
Example 1: random number python
from random import randint
value = randint(0, 10)
print(value)
Example 2: python random number
from random import randint
print(randint(1,3))
Example 3: how to generate a random number python
import random
n = random.randint(0,22)
print(n)
Example 4: how to get random number python
import random
minimum_int, maximum_int = 0, 10
random_number = random.randint(minimum_int, maximum_int)
Example 5: random picker in python
import random
x_dict = {30:60, 20:40,10:20}
key = random.choice(list(x_dict))
print (key)
print (x_dict[key])
print (key,"-", x_dict[key])
Example 6: how to get a random number in python
def randnum(min, max):
num = random.randint(a, b)
return num
randomnumber = randnum(0,10)
print(randomnumber)