+ 9
What is the problem in my code
Average word length problem a=input() list=a.split(" ") b=a.replace(" ","") c=(len(b)/len(list)) print(round(c))
7 Answers
+ 9
1.
Good logic!!! OMGable!
2.
don't use built in function names! Instead use lst or l
3.
Try to this:
c = len(b)/len(list)
result = round(c, 2)
+ 9
Works like a charm
+ 1
My code show error in some test cases in sololearn avrage word length problem
+ 1
if c>int(c):
c=int(c)+1
Add this code before print
It actually works
+ 1
In case of 15/5 my code showe 4 and expectad coutput is 3
+ 1
I solved this program
And here is my code:
s=input()
s1=''
s2=s.split()
for i in s:
if i in 'abcdefghijklmnopqrstuvwxyz':
s1+=i
l=len(s1)/len(s2)
if l>int(l):
l=int(l)+1
print(l)
0
But your code works
What did you want?
What problem did you want to solve?