0
Letter frequency
Why my solution of "Average Word Length" task is wrong? text = input() new_text = text.split() number_of_signs = len(new_text) total = int((len(text)/len(new_text))) answer = print(total)
6 Antworten
+ 1
the most obvious way to do the second point is using a for loop over the list... and inside it add each items (words) length to number_of_signs...
0
because you're not doing it the right way...
you must add each words length in the 'new_text' list, and use that sum (wich doesn't count spaces of 'text' string) instead of len(text) ;)
0
Provide tag with programming type
0
I do really not know how to do it. Could You give me some tips, please? Thank You very much ina advance!
0
you should:
1) initialize the number_of_signs (letters) variable to zero
2) iterate the 'new_text' list and add each items (words) length to the number_of_signs variable
3) then you can compute the average by dividing the number_of_signs by the number of words (len(new_text))
0
How can I do the second point?