Average of given numbers
You are given space-sparated integers as input. write a program to print the average of the given numbers
INPUT
The first line of input contain space-seperated integer
OUTPUT
the output should be a float value rounded up to two decimal places
1 0 2 5 9 8
4.17
entered_list = input("Enter numbers separated by spaces: ").split()
num_list = list(map(int, entered_list))
avg = float(sum(num_list) / len(num_list))
print(round(avg, 2))
Comments
Leave a comment