Average word length in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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?

5th Aug 2020, 7:15 AM
Arieftia
Arieftia - avatar
7 Answers
+ 1
Where is the number 5.2 came from?
5th Aug 2020, 7:36 AM
Arieftia
Arieftia - avatar
+ 1
:v
5th Aug 2020, 7:44 AM
Arieftia
Arieftia - avatar
+ 1
In test case #1, it's have 5 word too but the results is 3?
5th Aug 2020, 7:52 AM
Arieftia
Arieftia - avatar
+ 1
I got it, thx
5th Aug 2020, 8:00 AM
Arieftia
Arieftia - avatar
+ 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))
5th Aug 2020, 8:13 AM
Arieftia
Arieftia - avatar
0
Hi my friend
5th Feb 2021, 12:27 PM
Hanaly Hanalyyev
Hanaly Hanalyyev - avatar
0
Please show me code of average word length
5th Feb 2021, 12:28 PM
Hanaly Hanalyyev
Hanaly Hanalyyev - avatar