Assignment 2 – Mad Libs Story
Write a Python program that creates and uses variables of different types. Get and store input from the user. Output information including escape characters.
Assignment Description
Create your own Mad Libs story. The idea of the Mad Libs game is to write down different words that fit parts of speech, and then incorporate those words into a prewritten story.
Steps
# ITP 115, Fall 2022
# Section: number or nickname
# Assignment 2
# Description:
# Describe what this program does such as:
# This program creates a Mad Libs story.
# It gets input from the user and prints output.
o 5 strings (str)
o 3 integers (int)
o 1 floating point number (float)
This content is protected and may not be shared, uploaded, or distributed.
ITP 115 2022-08-21
o Name the variables whatever you want, but use good coding practice.
o You can get more user input if you want.
o The strings need to be different parts of speech such as a noun, verb, adjective, adverb, or preposition. You can also ask for a special type of the part of speech, such as a place (“Disneyland”), a proper name (“Khurram”), or a color.
10.Create your own story. Do not use the story in the Sample Output.
11.Be sure to comment your code. This means that there should be comments throughout your code. Generally, a comment for every section of code explaining what it does. Points will be deducted for not having comments.
12.Follow coding conventions.
13.Test the program. Look at the Sample Output below. Assignments that do not run are subject to 20% penalty.
14.Prepare your submission:
o Find the a2_last_first folder on your computer and compress it. This cannot be
done within PyCharm.
o On Windows, use File Explorer to select the folder. Right click and select the Send to -> Compressed (zipped) folder option. This will create a zip file.
o On Mac OS, use Finder to select the folder. Right click and select the Compress “FolderName” option. This will create a zip file.
Page 2 of 4
ITP 115
2022-08-21
15.Upload the zip file to your Blackboard section:
o On Blackboard, navigate to the appropriate item.
o Click on the specific item for this assignment.
o Click on the Browse Local Files button and select the file. o Click the Submit button.
Grading
edit the source code to test your program.
Item Points
Reading in each individual input (9) 9
Mathematical calculation 2
User input is in the story with surrounding quotes 9
Comments, style, and proper submission 5
Total
25
Page 3 of 4
ITP 115
Sample Output
Enter an animal (plural): sloths
Enter an adjective: funny
Enter another adjective: hungry
Enter a verb: fly
Enter a verb ending in ‘ing’: playing chess Enter a number: 3
Enter a second number: 10
Enter a third number: 4
Enter a number with a decimal: 3.2
2022-08-21
Today I adopted “3” pet “sloths”.
I learned that each animal needs “3.2” hours of “playing chess” every day, and that they travel in groups of “4”.
They are so “funny” that I decided to adopt “10” more.
Now I have “13” “sloths” and I am so “hungry” that I want to “fly”.
Page 4 of 4