+ 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'

18th May 2020, 4:32 PM
Vignesh
Vignesh - avatar
8 Réponses
+ 1
Its all problem with spaces. Try to replace all spaces with new one.
18th May 2020, 4:39 PM
Learn11
+ 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
18th May 2020, 8:10 PM
Abhay
Abhay - avatar
0
Learn11 Which spaces??
18th May 2020, 7:00 PM
Vignesh
Vignesh - avatar
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))
19th May 2020, 2:08 AM
Ahmed Muhammed
Ahmed Muhammed - avatar
0
Rithea Sreng why should i copy when I'm here to learn😏
19th May 2020, 4:02 AM
Vignesh
Vignesh - avatar
0
Abhay I copied and pasted from the compiler that's in Google where i tried this code
19th May 2020, 4:03 AM
Vignesh
Vignesh - avatar