+ 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
8 odpowiedzi
+ 9
+ 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.
+ 9
Thanks Anna
+ 7
⏩ Prometheus ⏪ your answer is very good but a beginner. I don't understand it.
+ 4
What language do you want it to be in?
+ 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.
+ 2
You could do something like
print(sum([float(input(f'Enter value #{i+1}: ')) for i in range(5)]))