Advertisement
Programmin-in-Python

Vowels and Consonants in a String

Dec 18th, 2020
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. str_1 = input("Enter The String : ")
  2.  
  3. vow, cons = (), ()
  4.  
  5. for i in str_1:
  6.   if i.lower() in ('a','e','i','o','u'):
  7.     vow += (i,)
  8.   else:
  9.     cons += (i,)
  10.  
  11. print(f"Consonants in the string '{str_1}' : ", end="")
  12. for i in cons :
  13.   print(i,end="")
  14.  
  15. print(f"\nVowels in the string '{str_1}' : ", end="")
  16. for i in vow :
  17.   print(i,end="")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement