+ 1
How i solve Average word length problem
This is my Code ,test case 1,2,4 are correct,what is the problem I can't find , input=input('') input=input.split(' ') wordlist=0 for i in range(len(input)): #print(len(input[i])) wordlist += len(input[i]) average=int(round(wordlist/len(input))) print(average)
3 Answers
+ 5
Ruhul Amin , to help you we need to get the complete task description that is shown in this code coach task. Thanks!
0
Not sure but I think '?' and '.' are not counted as words' characters.
Remove every '?' and '.' in the input then check if your code works fine.
0
Another mistake you've made is that you are rounding the answer down OR up (in some cases up and in some other cases down). You have to round it up in every case (use math.ceil).