+ 1

I am stuck in Average Word Length problem in python...can anyone help plz....code is correct but still showing eror in print

20th Sep 2020, 6:10 PM
sumit mehta
sumit mehta - avatar
6 odpowiedzi
+ 7
First of all, you should show your attempt by posting your code here. As it is a code coach challenge, we can not help you with coding, but by giving you hints. Thanks!
20th Sep 2020, 6:17 PM
Lothar
Lothar - avatar
+ 3
sumit mehta Here for you... from math import ceil s=input().split() c=0 d=0 for i in range(len(s)): for j in range(len(s[i])): if(s[i][j]!='?'): c+=1 d+=1 x=c/d print(ceil(x))
20th Sep 2020, 6:57 PM
Emily Swans
Emily Swans - avatar
0
Now that's great advice,thanks Lothar
20th Sep 2020, 6:18 PM
Cleopatra
Cleopatra - avatar
0
import math a=str(input()) count=0 for i in range(len(a)): if(a[i]==" "): count+=1; a=((len(a))-count) v=a/(count+1) e=math.ceil(v) print (e) This is the code....btw that problem related print statement is solved...now I have problem that this code runs but only first case test is not passing...
20th Sep 2020, 6:34 PM
sumit mehta
sumit mehta - avatar
0
As per example they given... For 5.2 they make it integer to 6 means rounded to ther next int.....so I have used ceil() to satisfy this condition...but in first test case for 3.2 the required output is 3.... Can anyone help
20th Sep 2020, 6:36 PM
sumit mehta
sumit mehta - avatar
- 1
I'm always getting stuck everywhere,not good advice but still advice I pick a topic from every skill.
20th Sep 2020, 6:15 PM
Cleopatra
Cleopatra - avatar