0

I tried several rounding methods for the average value, butevery time atleast one case gets wrong. Any advice is appreciated.

string=input() sub=string.split() count=0 for i in range(len(sub)): count+= len(sub[i]) avg=round(count/len(sub)) print(avg)

17th Feb 2020, 10:09 PM
Tharindu
Tharindu - avatar
3 Antworten
+ 1
That's the average word length coding problem, isn't it? Did you notice that one has to remove the punctuation signs first?
17th Feb 2020, 10:25 PM
vad lensky
vad lensky - avatar
17th Feb 2020, 10:28 PM
Gabriel Ilie
Gabriel Ilie - avatar
0
Thank you for the valuble answers. It worked after removing the punctuation.
18th Feb 2020, 12:30 AM
Tharindu
Tharindu - avatar