lundi 1 août 2016

How to find number of vowels in each word of string using python

s=input("Enter a sentence: ")

emp = "" vow=0 for i in s: if i.isspace() == False: emp = emp+i else: for j in emp: if j in 'aeiouAEIOU': vow=vow+1 print("The number of vowels in",emp,"are",vow) emp = "" it only gives vowels for first word.

Aucun commentaire:

Enregistrer un commentaire