Nov-17-2019, 05:37 PM
(This post was last modified: Nov-17-2019, 06:59 PM by ichabod801.)
Hello,
I am trying to display the minimum number in a randomly created list but I am getting noting printed for the min function. I have my codes and display below. Any help is highly appreciated.
Here are the codes:
I am trying to display the minimum number in a randomly created list but I am getting noting printed for the min function. I have my codes and display below. Any help is highly appreciated.
Here are the codes:
import random
random_numbers = []
average = 0
total = 0
for i in range(3):
x = int((random.randint(0, 9)))
random_numbers.append(x)
total = sum(random_numbers)
average = float(total / 3)
random_numbers = ', '.join(map(str, random_numbers))
print(random_numbers)
print("Low:", min(random_numbers))
print("High:", max(random_numbers))
print("average:", format(average,'.2f'))
print("Total:", total)Here is the display:Output:>>>
9, 3, 2
Low:
High: 9
average: 4.67
Total: 14
>>>
