Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that takes items from three different lists and uses them to create sentences. Define three lists named nouns, verbs, and adjectives. The

Write a program that takes items from three different lists and uses them to create sentences.
Define three lists named nouns, verbs, and adjectives. The lists contain, respectively:
[ "dog", "bird", "rock", "spaceship", "candidate", "waterfall" ]
[ "ran", "fell", "flew", "sat", "breathed", "tumbled" ]
[ "quickly", "slowly", "carefully", "quietly", "peacefully", "regretfully" ]
Use a while() loop to count through the indexes starting at 0. Use the length of the nouns list to determine
when to stop counting through the indices.
For each index select each list value for that index to build and print a sentence. For example, when the index
is 3 you will build the sentence
The spaceship sat quietly.
After you print the sentence, append the index value to a list named used.
After all the sentences are printed, display the used list item by item, using a for-in loop (do not just say
print(used)). Print all the list items on a single line separated by commas, followed by a line that says, All
done., as in
Used: 0,1,2,3,
All done.
Notice that each item is followed by a comma. For 5 extra credit points, print the list so that there is no
comma after the last item. In either case, be sure that All done is on the next line.

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

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago