+ 2
outputs avg length ofword in the sentence and rounds it to the next whole no. ........but when I input- Can you not do that?
https://code.sololearn.com/cx5m1TGY28lR/?ref=app It gives wrong output for this input It should be exactly 3 But it comes to be 3.2 And then it rounds it to 4 Plz help finding the bug!!!!
4 Respuestas
+ 3
Hope it helps you!!
you have used isalpha in place of isalpha().
from math import ceil
phrase = input() or "Can you not do that?"
count = 1
alph = 0
l = len(phrase)
for i in range(l) :
if phrase[i]==" " :
count += 1
elif phrase[i].isalpha() :
alph += 1
else :
continue
avg = ((alph)/(count))
print(phrase)
print(ceil(avg))
+ 2
from math import ceil
phrase = input()
count = 1
alph = 0
for i in phrase :
if i==" " :
count += 1
elif i.isalpha :
alph += 1
else :
continue
avg = ((alph)/(count))
print(ceil(avg))
May This Helps You!
+ 1
thank you ,I didn't noticed that
I should'nt have done that .....it's my bad