Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string = str(input("Enter a string: "))
- vowels = "aeiouAEIOU"
- consonant_count_string = 0
- for i in string:
- # Check if the character is an alphabet
- if i.isalpha():
- # Check if the character is not a vowel
- if i not in vowels:
- consonant_count_string += 1
- print(consonant_count_string)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement