0

Average Word Length Code Coach Challenge

What's wrong? from functools import reduce import string text = input() for char in list(text): if char in list(string.punctuation): text = text.replace(char, '') words = text.split() wordCount = len(words) charCount = reduce(lambda x, y: x + y, [len(word) for word in words]) avg = round(charCount / wordCount) print(avg)

27th Jun 2021, 1:06 PM
Yahel
Yahel - avatar
1 Respuesta
+ 2
Question says "round up", not simply round it . Make use of math library ceil function instead of round.
27th Jun 2021, 1:10 PM
Abhay
Abhay - avatar