Control Flow: The if
, elif
, else
Statements
Find minimum and maximum values
How can we find the minimum and the maximum values of 10 randomly generated numbers between 0 and 100?
import random
min = 100
max = 0
for _ in range(10):
number = random.randint(0, 100)
print(number)
if (number < min):
min = number
if (number > max):
max = number
print("Min:", min)
print("Max:", max)