Write a program to read a string containing letters, each of which may be in either uppercase or lowercase, and return a tuple containing the number of vowels and consonants in the string in python

Code

def count_vowels_consonants(s):
vowels = "aeiou"
count_vowels = 0
count_consonants = 0
for char in s.lower():
if char in vowels:
count_vowels += 1
elif char.isalpha():
count_consonants += 1
return (count_vowels, count_consonants)

if __name__ == "__main__":
s = input("Enter a string: ")
count_vowels, count_consonants = count_vowels_consonants(s)
print("Vowels: %d Consonants: %d" % (count_vowels, count_consonants))

Output