+ 2

Can you please help me?

the task requires the user to input a list of numbers with a terminating number 0 then it will print the number of input excluding 0 and that is count also it will print the sum of the numbers lastly print the mean of those numbers https://code.sololearn.com/c193uR5p108R/?ref=app

30th Mar 2023, 2:23 PM
Erika Abalora
15 Respostas
1st Apr 2023, 7:55 AM
JaScript
JaScript - avatar
+ 10
1. I do not understand why you need: ‱ 2 while loops ‱ eval() function ‱ nested if-statements 2. What I would suggest: ‱ Rather than asking for each number separately, you can input a list of numbers separated by comma, such that: 1,2,3,4,5 ‱ Split the input received by comma to make a list ‱ Convert items in a list into an integer, e.g. "3" -> 3 ‱ Use built-in functions such as len() & sum() to get functionality you want ‱ Do not use built-in functions as variable names. 3. To improve, you can: ‱ Add validation that will check/restrict some input entered by the user, e.g. entering text rather than numbers ‱ Add some code that will catch exceptions such as: TypeError, ZeroDivisionError For your information; there is a built-in python math module, which already has this functionality, however try to do it yourself to solidify your skills in python.
30th Mar 2023, 2:55 PM
Lamron
Lamron - avatar
+ 9
Ela , the task description is a bit weak, so we need to know: > what is the first number for? does it define how many numbers should be input? let's assume we wanted to get 5 numbers taken by ths input function. where do you store these numbers for the requested calculations?
30th Mar 2023, 3:51 PM
Lothar
Lothar - avatar
+ 5
The task is not clear for me too. I think this code will help you: https://code.sololearn.com/c0xN23ffvRki/?ref=app
30th Mar 2023, 6:03 PM
JaScript
JaScript - avatar
+ 5
Lamron Please note that the collection of numbers ends with the input of the number zero. For example as presented input example at the beginning of this code and I think like Ela wanted: 2 4 0
30th Mar 2023, 7:01 PM
JaScript
JaScript - avatar
+ 4
Can you show us your solution?
1st Apr 2023, 8:01 AM
JaScript
JaScript - avatar
+ 3
You are welcome Ela
1st Apr 2023, 8:27 AM
JaScript
JaScript - avatar
+ 1
JaScript EOFError line 12
30th Mar 2023, 6:49 PM
Lamron
Lamron - avatar
+ 1
I solved it
1st Apr 2023, 7:49 AM
Erika Abalora
+ 1
yes thankyouuu JaScript
1st Apr 2023, 8:12 AM
Erika Abalora
0
Help mi
31st Mar 2023, 6:32 PM
Kunal Sankliya
Kunal Sankliya - avatar
0
I edited the question
1st Apr 2023, 7:30 AM
Erika Abalora