ASSIGNMENT
Q.2
Q.2 Write a Python program to count the number of vowels and consonants in a string entered by the user.
string = input("Enter a string: ") vowels = 0 consonants = 0 for ch in string: if ch.isalpha(): # Check if the character is an alphabet if ch.lower() in "aeiou": vowels += 1 else: consonants += 1 print("Number of Vowels:", vowels) print("Number of Consonants:", consonants)


