Write a Python function that takes a string input and checks…
Write a Python function that takes a string input and checks the number of vowel (a, e, i, o, u, A, E, I, O, U) and consonant. Print the number of vowels and consonants. (Hint: Use the char.isapha() function in an if condition statement. isalpha() is used to check if a string consists only of alphabetic characters). Guide: Create function name and input parameter (one line of code) Create variables for vowels and initialize it to the value given in the question. Creating two variables to count number of variables and number of consonants and initialize them to 0. Use for loop to iterate each character (char) in an input string (input parameter to functions) Under the for loop use if to call isalpha function: char.isalpha(): Use if to check characters (char) which are vowels Increment number of vowels if condition is true else increment number of consonants.
Read Details