Ask Question
26 October, 19:20

Your program will read a word (or a whole line) from the user. It will then count the number of vowels in the word (or line) and print put this value. You should ignore the semi-vowel y since determining its role requires dividing words into syllables which is hard to do in English. The program should end when the word END is entered. Example Input and Output: Enter a word: Vowel The word Vowel contains 2 vowels. Enter a word: determining The word determining contains 4 vowels. Enter a word: WILL The word WILL contains 1 vowel. Enter a word: END

+4
Answers (1)
  1. 26 October, 20:32
    0
    Following are the program in the Python Programming Language.

    def vowel () : #define function

    print ("Enter END to Break") #print message

    while (True) : #set while loop

    word=input ("Enter words: ") #get input from the user

    count=0 #set count to 0

    if (word=="END") : #set if condition

    break #terminate the loop

    else:

    for i in range (len (word)) : #set the for loop

    c=word[i] #initialize in c

    if (c=='a'or c=='e' or c=='i'or c=='o'or c=='u'or c=='A'or c=='E'or c=='I'or c=='O'or c=='U'):

    count+=1 #increament in count by 1

    print ("The word ", word, " contains ", count, end=" ") #print message

    if (count==1) : #check condition

    print ("vowel.")

    else:

    print ("vowels")

    #call the function

    vowel ()

    Output:

    Enter END to Break

    Enter words: Vowel

    The word Vowel contains 2 vowels

    Enter words: END

    Explanation:

    Here, we define a function "vowel () " inside it.

    Print message for the user. Set the while loop and pass condition is True then, get input from the user in the variable "word" then, set variable "count" and initialize to 0. Set if condition to check if the user input "END" then, the loop will terminate. Otherwise, set for loop which continues from the length of the word. Then, we set if statement which checks the vowel in the word, then increment in count by 1. Print the message in the following format which is mentioned in the question. Then, set if-else statement for check count is equal to 1 then print "vowel." Otherwise, it prints "vowels."

    Finally, we call the following function "vowel () ".
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Your program will read a word (or a whole line) from the user. It will then count the number of vowels in the word (or line) and print put ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers