create random integer python code example

Example 1: python function to print random number

import random
n = random.randint(0,22)
print(n)

Example 2: random number pythn

import random
n = random.randint(0,22)
print(n)

# Output: 2

Example 3: random.uniform python

#In contrast to randInt .random.uniform generates a floating number between two variables
# imports random
import random
# randint generates a random integar between the first parameter and the second
print(random.randint(1, 100))