+ 1
Average word length in python
https://www.sololearn.com/coach/73?ref=app It's have 5 word and 26 letter (space not count) Why the results is 5.2 and round it up to 6?
7 Réponses
+ 1
Where is the number 5.2 came from?
+ 1
:v
+ 1
In test case #1, it's have 5 word too but the results is 3?
+ 1
I got it, thx
+ 1
What wrong with this code?
import math
import string
sentence = input()
for punc in string.punctuation :
word = sentence.replace(punc, "")
word_list = word.split()
word_count = len(word_list)
ch = word.replace(" ", "")
ch_count = len(ch)
print(math.ceil(ch_count/word_count))
0
Hi my friend
0
Please show me code of average word length