Question: Python: write a function which returns the number of syllables in a word. Assume that the syllables are determined as follows: -> Each sequence of
Python: write a function which returns the number of syllables in a word. Assume that the syllables are determined as follows:
-> Each sequence of vowels (a,e,i,o,u,y), except for the last e in a word, is a vowel.
-> If the algorithm yields a count of 0, change it to 1
-> The function should only return the syllable count
Below is the pre-written code for the function. Your code should start at and replace the word 'pass':
def syllable_count(word): """ Returns the number of syllables in the word. For this exercise, assume that syllables are determined as follows: Each sequence of vowels a e i o u y, except for the last e in a word, is a vowel. However, if that algorithm yields a count of 0, change it to 1. :param word: the word whose syllables are being counted. >>> syllable_count('Harry') 2 >>> syllable_count('HAIRY') 2 >>> syllable_count('hare') 1 >>> syllable_count('the') 1 """ # replace pass below with your code pass Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
