python program to tell the number of words in code without length function?the error is unexpected .plzz tell where i am wrong
i've been trying this code from 1 hour and its output coming out is really unexpected.
var=input('sentence')
no=1
for i in var:
if i==" ": #i've added a space as the number of words will be the number of spaces in a sentence
no+=1
print(no)
Aucun commentaire:
Enregistrer un commentaire