In: Computer Science
Write a Python program with correct indentation using functions and mainline logic which prompts the user to enter a number, then generates that number of random integers and stores them in a list. It should then display the following data to back to the user:
main.py
import random
n = int(input("Enter a number: "))
randNumList = []
for i in range(0, n):
randNum = random.randint(0,100)
randNumList.append(randNum)
print("Numbers:",randNumList)
print("The lowest number in the list =",min(randNumList))
print("The highest number in the list =",max(randNumList))
print("The total sum of all the numbers in the list
=",sum(randNumList))
print("The average number in the list =",sum(randNumList)/n)
Code Snippet (For Indentation):
Output: