About the Average Word Length problem
I am struggling with this problem since yesterday. I did what i can do, but I couldn't get 5/5. No matter what i did, I always get 3/5. can you see what I'm missing in this code? # as a remainder, the average word length problem is: you have an input with multiple words, and the output should be the average of letters per word rounded to the nearest whole number. And Here's the code: import string punc= string.punctuation test= input() phrase=" " count_letter =0 count_word =0 for i in range(len(test)): phrase +=str(test[i]) if phrase[i] == " ": count_word +=1 if phrase[i] != " " and (phrase[i] not in punc): # not counting spaces and punctuations count_letter +=1 print(round((count_letter +1)/count_word))