Skip to content
This repository was archived by the owner on Nov 17, 2025. It is now read-only.

Commit 7174242

Browse files
author
Kalpak Take
authored
Add files via upload
1 parent 0c97b9c commit 7174242

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

madLibs.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
libs =["Dragon Freak","Excuses"]
2+
3+
# precode
4+
def dragonFreak():
5+
colorDrag = raw_input("Color : ")
6+
superLatDrag = raw_input("Superlative (ending in est) : ")
7+
adj1Drag = raw_input("Adjective : ")
8+
bodyDragPlu = raw_input("Body Part Plural : ")
9+
bodyDrag = raw_input("Body Part : ")
10+
nounDrag = raw_input("Noun : ")
11+
animalDrag = raw_input("Animal(Plural) : ")
12+
adj2Drag = raw_input("Adjective : ")
13+
adj3Drag = raw_input("Adjective : ")
14+
adj4Drag = raw_input("Adjective : ")
15+
# creating madlib
16+
fMadLib = '''
17+
The %s Dragon is the %s Dragon of all. It has %s %s,
18+
and a %s shaped like a %s. It loves to eat %s,
19+
although it will feast on nearly anything. It is %s and %s.
20+
You must be %s around it, or you may end up as it`s meal!
21+
'''%(colorDrag , superLatDrag , adj1Drag , bodyDragPlu , bodyDrag , nounDrag , animalDrag , adj2Drag , adj3Drag , adj4Drag)
22+
23+
print(fMadLib)
24+
25+
def excuses():
26+
place = raw_input("Place : ")
27+
adjExcuse = raw_input("Adjective : ")
28+
bodyPart = raw_input("Bodypart : ")
29+
30+
fMadLib = '''
31+
I cannot come to %s ,
32+
because there is %s %s flu
33+
''' %(place , adjExcuse , bodyPart)
34+
35+
# main code for user interaction
36+
while True:
37+
startOrEnd = raw_input("Start or End : ")
38+
if startOrEnd.strip() == "Start":
39+
print(libs)
40+
whichLib = raw_input("Which one :")
41+
if whichLib.strip() == "Dragon Freak":
42+
print(dragonFreak())
43+
continue
44+
elif whichLib.strip() == "Excuse":
45+
print(excuses())
46+
continue
47+
else :
48+
print("Not avaliable")
49+
continue
50+
elif startOrEnd.strip() == "End":
51+
print("Progarm Ended...")
52+
break

0 commit comments

Comments
 (0)