Answer:
The program to this question as follows:
Program:
s= input("Please Enter your String : ")#input value from user in String variable
vowel= 0 #defining integer variable
consonant= 0 #defining integer variable
for i in s: #defining for loop for count vowel and consonant
if(i == 'a' or i == 'e' or i == 'i' or i == 'o' or i == 'u'
or i == 'A' or i == 'E' or i == 'I' or i == 'O' or i == 'U'): #if block that check vowels
vowel = vowel + 1 #adding value in vowel variable
else: # count consonant
consonant = consonant + 1 #adding value in consonant variable
print("Number of Vowels: ", vowel) #print vowel
print("Number of Consonant: ", consonant) #print consonant
Output:
Please Enter your String : Database is a collection row and column
Number of Vowels: 14
Number of Consonant: 25
Explanation:
In the above python code three variable "s, vowel, and consonant" are defined, in which variable s is used to input a string value from the user end, and the "vowel and consonant" variable is used to count their values.