0
How to fix this error in this code
Calculate the arithmetic mean of integer numbers you will receive the integers on separate lines .the numeric sequence ends with a period . , so stop readind the input on it https://code.sololearn.com/cNiIxJn6s7DU/?ref=app
4 Respostas
+ 3
total = 0
i = 0
while True :
n = input()
if n == '.':
break
total += int(n)
i +=1
print(total / i)
+ 1
Hi, I made some Small changes, check it out. I hope it gets closet to what you are looking to do.
https://code.sololearn.com/cre5WJKH4E1Z/?ref=app
0
Try this:
total = 0
i = 0
while True :
n = input()
total += int(n) if n.isnumeric() else 0
if n == '.':
break
i +=1
print(total/i)
0
Thank you so much it still wrong what about if we enter -3,6,-6,-5,3,1,-1,0,.
we will get 1.25 which is wrong answer
any ideas .i apprecited your efforts