count consonant letters in python program with user input
Answers
Answered by
3
Required python program:
n = input("Enter a string: ")
exception = ("a", "e", "i", "o", "u")
consonants = ""
for i in n:
if 'a' <= i.lower() <= 'z':
if not i.lower() in exception:
consonants += i
print(len(consonants))
[For output see the attachment]
Attachments:
Similar questions