Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a short script that will have the user enter in words until the word quit is entered. You will then display a sorted list

Write a short script that will have the user enter in words until the word quit is entered. You will then display a sorted list of words, and list how many vowels appear in each word, next to the word. (Hint: how can we use our string methods to make things easier for us?)

Sample output

Enter a word (quit to stop): hello again 3

Enter a word (quit to stop): again are 2

Enter a word (quit to stop): how hello 2

Enter a word (quit to stop): are how 1

Enter a word (quit to stop): you you 2

####################################

this is my code so far

vowels = 0 words = []

truth = True

while truth: word = input('Enter a word ("quit" to stop): ') words.append(word) words = list(word) for cha in words: if cha == 'a' or cha == 'e' or cha == 'o' or cha == 'i' or cha == 'u': vowels +=1 if word == 'quit': truth = False print("vowels: " + str(vowels)) print(words)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL/PHP Database Applications

Authors: Brad Bulger, Jay Greenspan, David Wall

2nd Edition

0764549634, 9780764549632

More Books

Students also viewed these Databases questions

Question

7. What traps should she avoid?

Answered: 1 week ago

Question

5. What decision-making model would you advocate to this person?

Answered: 1 week ago

Question

6. What data will she need?

Answered: 1 week ago