+ 1
Average Word length code coach. Failed test case 5. Why failed? Explained for me?
import math text = input() wordLength = text.count(' ') + 1 letterLength = len(text) - wordLength print(math.ceil(letterLength / wordLength))
4 Answers
+ 2
letterLength is not len(text) - wordLength because you have +1 in your wordLength calculation.
+ 1
you should calculate each word length first, and then calculate the average
0
thanks, but very general answer
0
could you my code review, and then explain my fault?