Python
import time
# a madlib
# one day the _____ (animal) went to Miller.
# It _____ (past tense verb) into room 7.
# Ms. Everhardt ran to ____ (fav place) screaming.
# tell user what this program does
##print("Hi there! 😊 How's your day going?")
##print(" ⚠️ Notice: This is a ChatGPT-powered program designed to
play Mad Libs only! It will only respond to properly formatted
inputs. 😊")
##print("But, I can calculate simple multiplication and calculations
ONLY AT THE END when the program is almost finished running, so feel
free to ask!")
##print("(By the way, a Madlib is a program that asks for inputs and
creates a story. Enjoy!)")
# ask for the words to fill in the blanks
##animal = input("Tell me an animal: ")
##verb = input("Tell me a past tense verb: ")
##fav_place = input("Tell me your favorite place: ")
# tell the madlib
##print("One day the" ,animal, "went to Miller.")
##print("It" ,verb, "into room 7.")
##print("Ms. Everhardt ran to", fav_place, "screaming.")
##print("
####################################################################
###
#Calculation code
##def calculate(operation, num1, num2):
##if operation == "add":
##return num1 + num2
##elif operation == "subtract":
##return num1 - num2
##elif operation == "multiply":
##return num1 * num2
##elif operation == "divide":
##if num2 == 0:
##return "Error: Division by zero is not allowed."
##return num1 / num2
##elif operation == "power":
##return num1 ** num2
##else:
##return "Error: Invalid operation."
####################################################################
###
# Introduction
print("COPYRIGHT: This code is copyright by Jian Lee coding©, and
must be emailed to jianjjlee@gmail.com for permission to copy the
code. No code may be copied without any permission from the creator,
unless granted. This is Madlib Beta, so feel free to email any
suggestions to jianjjlee@gmail.com ONLY for those purposes or
questions.")
####################################################################
##
time.sleep(5)
print("___________________________________")
time.sleep(4)
print("Loading Madlib simulator...")
time.sleep(3)
print("Fixing errors...")
time.sleep(3)
print("Tiding up the house...")
time.sleep(3)
print("____________10%_____________")
time.sleep(1)
print("____________20%_____________")
time.sleep(1)
print("____________40.4%_____________")
time.sleep(1)
print("____________50%_____________")
time.sleep(1)
print("____________60.9%_____________")
time.sleep(1)
print("____________87%_____________")
time.sleep(2)
print("____________96.45%_____________")
time.sleep(2)
print("____________100%_____________")
time.sleep(3)
print("JIAN CODING STUDIOS")
time.sleep(3)
print("Presents... ")
print("The Madlib simulator!!!")
time.sleep(5)
print("__________________________________________")
print("Hi there! 😊 How's your day going?")
print(" ⚠️ Notice: This is a ChatGPT-powered program designed to play
Mad Libs only! It will only respond to properly formatted inputs.
😊")
print("But, I can calculate simple multiplication and calculations
ONLY AT THE END when the program is almost finished running, so feel
free to ask!")
print("(By the way, a Madlib is a program that asks for inputs and
creates a story. Enjoy!)")
# Ask for the words to fill in the blanks
feeling = input("Hi there! 😊 How's your day going?(Great, mid,
bad)")
print("Since your day is going",feeling,"let's play a game!")
print("We will be playing a madlib, and it will ask you questions
but don't worry! The memory will be erased, so don't be afraid of
inputing information! However, do not intentionally input misused
information, so be careful!")
print("___________ Questions: ___________")
name = input("What is your name?(Bob Chat, Jimmy Carl, etc.)")
name2 = input("Who is someone you know/is your friend?")
email2= input("What is the email of your friend?")
email = input("What is your email address?")
animal = input("Tell me an animal: (Cat, dog, etc.)")
verb = input("Tell me a past tense verb(ran, walked, moonwalked): ")
fav_place = input("Tell me your favorite place: (Paris, etc.)")
fav_place2 = input("Tell me a place in your favorite place.")
home = input("What is your home address?")
fav_phase = input("What is your favorite thing to say?(make sure to
add a exclamation mark!)")
print("Now I will create the story! Wait a sec...")
time.sleep(4)
print("[Loading assets]")
time.sleep(3)
print("[Installing Import time]")
time.sleep(5)
print("___ Loading complete! ___")
time.sleep(4)
# Tell the Madlib story
print("____ Madlib story ____")
time.sleep(2)
print("Drumroll please...")
print("(BADUMBADUMBADUMMMMM!!!!)")
time.sleep(2)
print("Presenting.....")
time.sleep(3)
print("THE MADLIB!!!!")
print("Enjoy!!!")
print("____________________________________________")
print("One day a", animal, "went to",fav_place,".")
print("____________")
print("It", verb, "into",name,".")
print("____________")
print("",name,"ran to",fav_place2, "screaming",fav_phase,"!")
print("____________")
print("",name2,"took out their phone and emailed",email,"typing
'Where are you?!?!?'")
print("____________")
print("",name,"emailed to",email2,", saying 'I'm in",fav_place2,"!
I'm being chased-or I think-by an",animal,"!!! What should I
do?!?!?")
print("____________")
print("",name2,"emailed back, saying 'Go to",home,"!!! I'll meet you
there. Hopefully the",animal,"won't chase you down!")
print("____________")
print("",name,"emailed back to",name2,"'alrighty, thanks!'")
print("____________")
time.sleep(3)
print("5 hours later...(Just wait, be patient!)")
time.sleep(10)
print("'Okay,",name2,"I arrived",home,"!!!'",name2,"replies, 'okay,
I see you! I'll open the door!'")
print("'Okay, thanks! Thankfully the animal is not chasing
me!'",name,"replies.")
print("Later,",name2,"says, 'Okay, seeya!'")
time.sleep(3)
print("{'In the end,",name,"makes it safely home,")
print("and",name,"and",name2,"laugh together as they walk into their
home. The end!!!'}")
time.sleep(30)
print("Wait, you're still here?")
time.sleep(2)
print("FIINE, okay you can have the calculator thing now.")
time.sleep(2)
print("Enjoy!")
print("_______ Calculator ________")
print("-------------------------------")
print("- -")
print("- /| /| /| -")
print("- | \ / | ---- | -")
print("- | / \ | ---- | -")
print("- | | | -")
print("- -")
print("-------------------------------")
print("{Drawing copyright Jian Lee}")
# Optional calculation part
def calculate(operation, num1, num2):
if operation == "add":
return num1 + num2
elif operation == "subtract":
return num1 - num2
elif operation == "multiply":
return num1 * num2
elif operation == "divide":
if num2 == 0:
return "Error: Division by zero is not allowed."
return num1 / num2
elif operation == "power":
return num1 ** num2
else:
return "Error: Invalid operation."
# Optional calculation part
print("You can type 'stop' to exit or 'calculate' to continue doing
more calculations.")
while True:
calc_choice = input("Type 'calculate' to start the calculator or
'stop' to exit: ").strip().lower()
if calc_choice == "stop":
print("Exiting calculator. Thanks for calculating with me!
😊")
break
elif calc_choice == "calculate":
while True:
operation = input("Enter operation (add, subtract,
multiply, divide, power) or 'stop' to exit: ").strip().lower()
if operation == "stop":
print("Exiting calculator. Thanks for calculating
with me! 😊")
break
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
result = calculate(operation, num1, num2)
print(f"Result: {result}")
else:
print("Invalid input. Please type 'calculate' to start or
'stop' to exit.")