Advertisement
naren_paste

Consanants

Nov 22nd, 2023
623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | Source Code | 0 0
  1. string = str(input("Enter a string: "))
  2. vowels = "aeiouAEIOU"
  3. consonant_count_string = 0
  4.  
  5. for i in string:
  6.     # Check if the character is an alphabet
  7.     if i.isalpha():
  8.         # Check if the character is not a vowel
  9.         if i not in vowels:
  10.             consonant_count_string += 1
  11.  
  12. print(consonant_count_string)
  13.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement