183k views
4 votes
Design a program that asks the User to enter a series of 5 numbers. The program should store the numbers in a list then display the following data: 1. The lowest number in the list 2. The highest number in the list 3. The total of the numbers in the list 4. The average of the numbers in the list

User Tim Hobbs
by
3.3k points

1 Answer

1 vote

Answer:

The program in Python is as follows:

numbers = []

total = 0

for i in range(5):

num = float(input(": "))

numbers.append(num)

total+=num

print("Lowest: ",min(numbers))

print("Highest: ",max(numbers))

print("Total: ",total)

print("Average: ",total/5)

Step-by-step explanation:

The program uses list to answer the question

This initializes an empty list

numbers = []

This initializes total to 0

total = 0

The following loop is repeated 5 times

for i in range(5):

This gets each input

num = float(input(": "))

This appends each input to the list

numbers.append(num)

This adds up each input

total+=num

This prints the lowest using min() function

print("Lowest: ",min(numbers))

This prints the highest using max() function

print("Highest: ",max(numbers))

This prints the total

print("Total: ",total)

This calculates and prints the average

print("Average: ",total/5)

User Andrewrk
by
3.8k points