For this assignment type out a simple program that when it runs it will fill in
ID: 3738020 • Letter: F
Question
For this assignment type out a simple program that when it runs it will fill in the blanks of this story.
You will need to ask the user for 9 things.
A noun, a city, a number, a period of time, adjective 1, adjective 2, a person's name, a type of clothing and a color.
You need to ask the user for each identifier inside a set of ( ). When you have stored all of the appropriate words, display back to the user their mad lib.
"It is a little known fact that (noun 1)s have been watching (city 1) for (number 1) (period of time 1).
Only the (adjective 1) people believed that it was just a matter of time before (noun 1)s invaded the (adjective 2) city of (city 1).
(person's name 1), who was a (adjective 1) person tried to warn the people, telling them their best defense was to hang (type of clothing 1)s from the trees and (color 1) shoes on every door knob.
Unfortunately no one believed (person's name 1) and when (noun 1)s attacked (city 1), only the (adjective 1) people survived."
Then have it repeat as many time as the user would like to play.
Can you please do it in Python!!
Explanation / Answer
play = "1"
while (play == "1"):
noun = input("Enter a noun - ")
city = input("Enter a city - ")
number = input("Enter a number - ")
time = input("Enter a period of time - ")
adjective1 = input("Enter an adjective - ")
adjective2 = input("Enter another adjective - ")
name = input("Enter a name - ")
clothing = input("Enter a type of clothing - ")
color = input("Enter a color - ")
print("It is a little known fact that {}s have been watching {} for {} {}. Only the {} people believed that it was just a matter of time before {}s invaded the {} city of {}. {}, who was a {} person tried to warn the people, telling them their best defense was to hang {}s from the trees and {} shoes on every door knob. Unfortunately no one believed {} and when {}s attacked {}, only the {} people survived.".format(noun, city, number, time, adjective1, noun, adjective2, city, name, adjective1, clothing, color, name, noun, city, adjective1))
play = input("Want to play again? Type 1 to continue")
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.