0
How do I solve case 2
def average_word_length(sentence): words = sentence.split() return sum(len(word) for word in words) / len(words) sentence = "sololearn is awesome" print(average_word_length(sentence))
5 odpowiedzi
+ 4
"sentence" is an input value, not a fixed value
+ 4
TENGRANN SAN ,
there are some issues to fix in the code. may be you have overseen some details in the task description:
> input has to be done like: sentence = input()
> all *punctuation* in the input text has to be removed.
> the output value has to be *rounded up* to the nearest whole number.
after this corrections the code should run properly.
+ 1
It's the same problem as in here:
https://www.sololearn.com/discuss/3208736/?ref=app
You set a fixed value to variable sentence. So the code output will be fixed too, instead of processing the test cases.
Pls redo the lesson on user input.
0
Test case two is supposed to have an average of 4.7
0
Still dont understand