+ 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
15 Réponses
+ 4
Ela is it what will be expected?
https://code.sololearn.com/cA0CD1G9UzyV/?ref=app
+ 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.
+ 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?
+ 5
The task is not clear for me too. I think this code will help you:
https://code.sololearn.com/c0xN23ffvRki/?ref=app
+ 4
Can you show us your solution?
+ 3
You are welcome Ela
+ 1
JaScript EOFError line 12
+ 1
I solved it
+ 1
yes thankyouuu JaScript
0
Help mi
0
I edited the question