+ 12

Prompt user to input several value and add up the values

I need this to write a program to solve mean, median, mode etc

27th Dec 2018, 1:36 AM
Surveyor
Surveyor - avatar
8 Respuestas
27th Dec 2018, 2:29 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
27th Dec 2018, 2:21 AM
Surveyor
Surveyor - avatar
+ 9
Anna This is what I did. #Program to prompt user to input several values and add up the values a = float(input("Enter the first value: ")) b = float(input("Enter the first value: ")) c = float(input("Enter the first value: ")) d = float(input("Enter the first value: ")) e = float(input("Enter the first value: ")) f = a+b+c+d+e Print("The addition of the value is: " , f) But i want it in a more matured way.
27th Dec 2018, 6:14 PM
Surveyor
Surveyor - avatar
+ 9
Thanks Anna
27th Dec 2018, 6:47 PM
Surveyor
Surveyor - avatar
+ 7
⏩ Prometheus ⏪ your answer is very good but a beginner. I don't understand it.
27th Dec 2018, 2:49 AM
Surveyor
Surveyor - avatar
+ 4
What language do you want it to be in?
27th Dec 2018, 2:03 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
Felix Segun Can you please show your attempt to solve the problem? This is not a place to ask others to do your homework.
27th Dec 2018, 6:39 AM
Anna
Anna - avatar
+ 2
You could do something like print(sum([float(input(f'Enter value #{i+1}: ')) for i in range(5)]))
27th Dec 2018, 6:19 PM
Anna
Anna - avatar