0

Why does that test case 1 isn't working properly???

import math n = input().split(" ") a = 0 for i in n: b = len(i) a = a+b x = len(n) print(math.ceil(a/x)) Here is the question: You are in a college level English class, your professor wants you to write an essay, but you need to find out the average length of all the words you use. It is up to you to figure out how long each word is and to average it out. Task: Takes in a string, figure out the average length of all the words and return a number representing the average length. Remove all punctuation. Round up to the nearest whole number. Input Format: A string containing multiple words. Output Format: A number representing the average length of each word, rounded up to the nearest whole number. Sample Input: this phrase has multiple words Sample Output: 6

5th Jul 2021, 4:46 PM
Shahir
Shahir - avatar
1 Answer
+ 2
If you read the question properly , it says to take out any punctuation as well
5th Jul 2021, 4:50 PM
Abhay
Abhay - avatar