0
Can you help me find out mistake To calculate the average length of words in string and rounding it up to the nearest whole num.
# My code: str = input() strlist = str.split() sum = 0 count = 0 for word in strlist: length = len(word) sum += length count += 1 avg = sum / count print(round(avg)) 3rd and 5th test cases failed when I run this code..
1 Answer
+ 2
Average word length code coach :
In this question they told that "Remove all punctuation" ,I didn't see any code for removing punctuation .