Python Program to input any sentence and create a dictionary with consonant and vowels.


name= input ( 'Enter Any Sent.?' )

v_cnt=c_cnt=oth_cnt= 0 

vowels= 'aeiou'

for i in name :   

   if i.isalpha (): 

       if i in vowels :  

           v_cnt+= 1 

       else : 

           c_cnt+= 1

   else :  

       oth_cnt+= 1

print ( v_cnt , c_cnt ) 

d1= { 'consonant' : c_cnt , 'vowels' : v_cnt , 'Other' : oth_cnt }

print ( d1 )

Comments

Some popular posts

Python Program that computes the net amount of a bank account based a transaction log from console input.