Skip to content

Commit 20358b4

Browse files
authored
Add files via upload
Updated code to work with python3.
1 parent 9727cec commit 20358b4

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

3. Mad Libs Generator/src/MadLibsGenerator.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
def story():
33
template = "Didn't you hear? Supposedly %(noun)s %(verb)s is the new %(color)s."
44
dictionary = {}
5-
dictionary["noun"] = raw_input("Enter a noun: ")
6-
dictionary["verb"] = raw_input("Enter a -ing verb: ")
7-
dictionary["color"] = raw_input("Enter a color: ")
8-
print template % dictionary
5+
dictionary["noun"] = input("Enter a noun: ")
6+
dictionary["verb"] = input("Enter a -ing verb: ")
7+
dictionary["color"] = input("Enter a color: ")
8+
print(template % dictionary)
99

1010
def story2():
1111
template = "Every %(period_of_time)s I like to %(verb)s and %(verb2)s my %(emotion)s %(noun)s."
1212
dictionary = {}
13-
dictionary["period_of_time"] = raw_input("Enter a length of time: ").lower()
14-
dictionary["verb"] = raw_input("Enter a verb: ").lower()
15-
dictionary["verb2"] = raw_input("Enter another verb: ").lower()
16-
dictionary["emotion"] = raw_input("Enter an emotion: ").lower()
17-
dictionary["noun"] = raw_input("Enter a noun: ")
18-
print template % dictionary
13+
dictionary["period_of_time"] = input("Enter a length of time: ").lower()
14+
dictionary["verb"] = input("Enter a verb: ").lower()
15+
dictionary["verb2"] = input("Enter another verb: ").lower()
16+
dictionary["emotion"] = input("Enter an emotion: ").lower()
17+
dictionary["noun"] = input("Enter a noun: ")
18+
print(template % dictionary)
1919

2020
from random import choice
2121
stories = [story, story2]

0 commit comments

Comments
 (0)