+ 1
What's the mistake??
Average Word Length(code coach) import math s = str(input()) l = [] for i in s.split(" "): l1 = int(len(i)) l.append(l1) c = len(l) s = sum(l) print(math.ceil(s/c)) It runs in other IDE except here,shows error at 'import math'
8 Antworten
+ 1
Its all problem with spaces. Try to replace all spaces with new one.
+ 1
@Vignesh those spaces error occur when you copy the code as Rithea Sreng said ,you need to remove those spaces and put a space between them again
like the space between import and math
0
Learn11 Which spaces??
0
#this is the corrected code:
import math
s = str(input())
l = []
for word in s.split(" "):
word_length = len(word)
l.append(word_length)
c = len(l)
s = sum(l)
print(math.ceil(s/c))
0
Rithea Sreng why should i copy when I'm here to learn😏
0
Abhay I copied and pasted from the compiler that's in Google where i tried this code