Question: PYTHON: Counting the Vowels Function Define a function called counting_consonants that takes one formal parameter The function will count the number of consonants in the

PYTHON: PYTHON: Counting the Vowels Function Define a function called counting_consonants that takes

Counting the Vowels Function Define a function called counting_consonants that takes one formal parameter The function will count the number of consonants in the word and return the count. Formal Parameter phrase count the vowels in this phrase. To Do: 1. Define a local variable called count of vowels and initialize it to 0. 2. Define a local variable called vowels and initialize it to all vowels in the alphabet. We will consider 'y' as a consonant. There is not a constant like string.ascii_lowercase that returns all vowel letters. You will have to go through and manually do this. 3. Iterate through each character in the formal parameter. 1. if the character is in the vowels then increment the count of vowels 4. Return the count Function must have docStrings in order to receive full credit. Test your code. If you call this function with the phrase 'I love Programming!' you should get the value 6 in return. Spaces, consonance, and punctuation are not included in the count

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!