Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Ordered Vowels Program If anyone could provide me with the code below, I\'d be h

ID: 3556334 • Letter: O

Question

Ordered Vowels Program

If anyone could provide me with the code below, I'd be happy to give them the points. Once again this program is intended for Python.

I need to count how many words that have the vowels a e i o u in order in a word.txt file that I had to download.

I have to write two programs: One to count them, and one to print them out.

I was given a hint: Write a function"contains_vowels_in_order" (you may choose another name) which checks for the vowels. Look for the "a", then for the "e", etc.

This function could work with the string 'aeiou' and the word, staring with a counter at 0 and for each letter in the word, compare 'aeiou'[counter] against the letter, incrementing counter if they are equual; if it finds all vowels it can return true; if, on the other hand, it finishes the word without exhausting the vowels, it can return false.

Explanation / Answer

lines = [line.rstrip(' ') for line in open("word.txt")]

def contains_vowels_in_order(word,list_wo):
    counter = 0
    for i in range(len(word)):
        if word[i]==str[counter]:
            counter =counter+1
    if counter == 5:
        list_wo.append(word)
  

count = 0
list_word = []

counter = 0
str = "aeiou"

for word in lines:
    contains_vowels_in_order(word,list_word)  

print "Words are",list_word;  
print "Count of words are",len(list_word)


file word.txt should be in same directory

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote