Answer to Question #349124 in Python for SKVP

Question #349124

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

1
Expert's answer
2022-06-08T17:23:58-0400
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))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS