python make random number code example
Example 1: random number python
from random import randint
value = randint(0, 10)
print(value)
Example 2: generate random number python
import random
lower_limit = 0
upper_limit = 100
print(f"Here is a random number: {random.randint(lower_limit, upper_limit)}
Example 3: random python code
numbers = []
def while_loop(i, x, y):
while i < x:
print(f"At the top i is {i}")
numbers.append(i)
i = i + y
print("Numbers now: ", numbers)
print(f"At the bottom i is {i}")
print("The numbers: ")
for num in numbers:
print(num)
while_loop(0, 6, 1)