Average Word Length | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Average Word Length

I cant solve this test please help me it's in python data structure course lists test

14th Jul 2022, 10:30 AM
Eyad Elhady
Eyad Elhady - avatar
8 Answers
+ 3
"text" is a string, so you can use the string method replace(): text2 = text.replace(" ", "")
14th Jul 2022, 3:18 PM
Lisa
Lisa - avatar
+ 5
If you need help, please show us your code.
14th Jul 2022, 10:52 AM
Lisa
Lisa - avatar
14th Jul 2022, 10:57 AM
Ipang
+ 3
Then why not ask it directly when posting the thread? One way could be replaced all " " with "" and then getting the length.
14th Jul 2022, 2:50 PM
Lisa
Lisa - avatar
0
i just want to know how to remove the spaces from the count in (len)
14th Jul 2022, 2:44 PM
Eyad Elhady
Eyad Elhady - avatar
0
text = input() x = text.split() y = len(text) print(y/len(x)) this is my code it gave me the solution but it with extra Decimal it 6.66 and I want it 6
14th Jul 2022, 3:11 PM
Eyad Elhady
Eyad Elhady - avatar
0
i don't understand how to remove the space codeit, please
14th Jul 2022, 3:12 PM
Eyad Elhady
Eyad Elhady - avatar
0
Thanks♥️♥️
14th Jul 2022, 3:44 PM
Eyad Elhady
Eyad Elhady - avatar