Answered step by step
Verified Expert Solution
Question
1 Approved Answer
To practice console input and output of strings. A mad - lib is a fill - in - the blank game. One player writes a
To practice console input and output of strings.
A "madlib" is a fillinthe blank game. One player writes a short story in which some words are replaced
by blanks. For each word that is removed, the appropriate part of speech is noted: eg noun person
placething adjective word that describes a noun verb an action, eg eat adverb modifies a verb, eg
quickly Then, before reading the story, the storywriter asks the other player to write down a word of the
appropriate part of speech for each blank without knowing the context in which it will be used. In this way,
a humorous sometimes or nonsensical usually story is created.
Write your own madlib. It must have at least three blanks in it Now write a Python program that does
the following:
a Using the input syntax see the section "Reading Strings from the Keyboard" from the course read
ings for reading strings from the console, prompt the user to enter a word of the appropriate part of
speech for each blank in your program. Have a different, appropriately named variable refer to each
word.
b Print your story to the console using the print syntax, filling in the blanks in your story using the
strings referred to by the variables that you gathered in Step While it is possible to do this using a
single print readability of code is important! You are permitted to use as many print statements
as you wish.
You must write your own unique story. There is no good reason why two students should submit the same
story. Remember you must use a minimum of three blanks, and therefore, your program must read at
least three words from the console. You can have more blanks, but get all your other work done before
you spend a lot of time having fun with this question!
Sample Run
Here is an example of how your programs console output might look. Do not submit this story! Write your
own story. In our example, we use green text to show what the user typed in; blue text highlights where
the users data gets put in the story. If youre using PyCharm to run your program, the user input will also
be green, but it wont show any blue text.
Enter a verb ending in ing : zipping
Enter a noun : squirtle
Enter a verb past tense : zapped
Pikachu was zipping through some tall grass
Suddenly a squirtle appeared
The squirtle zapped Pikachu
It was not very effective
What to Hand In
A file called aqpy containing your finished program, as described above.
Evaluation
marks for reading text from the console;
marks for printing the story to the console in an aesthetically pleasing manner;
mark for choosing appropriate variable names variable names should be descriptive of the data
referred to by the variable; singleletters and abbreviations should be avoided
mark if identifying information is missing name NSID, student number and instructors name
Page
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started