Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Chat-Bot/Main
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
416 lines (410 sloc)
17.9 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import sys | |
Answer1 = True | |
Answer2 = True | |
Answer3 = True | |
Answer4 = True | |
Answer5 = True | |
def StyleText(text,y): | |
for l in text: | |
sys.stdout.write(l) | |
sys.stdout.flush() | |
time.sleep(y) | |
StyleText("Welcome to The Bakery\n",0.01) | |
string = str | |
goodanswer = True | |
StyleText("What is your name?\n",0.01) | |
string = input(": ") | |
string = string.capitalize() | |
while goodanswer: | |
if string.isalpha(): | |
goodanswer = False | |
x = (string) | |
goodanswer = False | |
else: | |
StyleText("Numbers and special characters are not accepted,\n",0.01) | |
StyleText("please enter your REAL name, excluding such characters\n",0.01) | |
string = input(":") | |
goodanswer = True | |
y = ("!") | |
Chocolate = ("The ingredients for the Chocolate Cupcake (for 10 Cupcakes) are:\n -120g Plain Flour\n -140g Sugar\n -1 Teaspoon Of Baking Powder\n -40g Unsalted Butter\n -50g Dark Chocolate\n -1 Free Range Egg \n -125ml Milk\n -1 Orange Juice\n") | |
Lemon = ("The ingredients for the Lemon Drizzle Cake (for 1 cake) are:\n -4.5 Free Range Eggs\n -300g Sugar\n -3 Lemons, only use Zests\n -1 Pinch Of Salt\n -80g of Unsalted Butter\n -240g Plain Flour\n -0.5 Teaspoon Baking Powder\n") | |
StyleText("Welcome " + x + y + "\n",0.01) | |
StyleText("*\n",0.01) | |
StyleText("*\n",0.01) | |
while Answer5: | |
StyleText("Choose Lemon Drizzle cake to view Recipe\n",0.01) | |
StyleText("Choose Chocolate Cupcakes to view Recipe\n",0.01) | |
StyleText("Type in 'Neither' to skip this step\n",0.01) | |
H = input(":") | |
H = H.lower() | |
if H == 'chocolate cupcake' or H == 'chocolate cupcakes' or H == 'chocolate' or H == 'cupcakes': | |
StyleText(Chocolate,0.01) | |
Answer5 = False | |
elif H == 'lemon cake' or H == 'lemon' or H == 'drizzle' or H == 'lemon drizzle' or H == 'lemon drizzle cake': | |
StyleText(Lemon,0.01) | |
Answer5 = False | |
elif H == 'neither': | |
Answer5 = False | |
else: | |
StyleText("Please type in one of the options given above\n",0.01) | |
Aswer5 = True | |
StyleText("Press enter to proceed",0.01) | |
input(":") | |
StyleText("*\n",0.01) | |
StyleText("Basic Ingredient . Small . Medium . Large\n",0.01) | |
StyleText("Plain flour . 250g . 500g . 750g\n",0.01) | |
StyleText("Sugar . 200g . 400g . 600g\n",0.01) | |
StyleText("Unsalted butter . 125g . 250g . 500g\n",0.01) | |
StyleText("Free-range eggs . Box of 6 eggs . Box of 10 eggs . Box of 12 eggs\n",0.01) | |
StyleText("*\n",0.01) | |
StyleText("Press enter to proceed",0.01) | |
input(":") | |
StyleText("*\n",0.01) | |
StyleText("*\n",0.01) | |
while Answer1: | |
d = str | |
StyleText("Would you like to order any of these recipes?\n",0.01) | |
d = input(":") | |
d = d.lower() | |
if d == 'n' or d == 'no': | |
StyleText("Thank you for shopping at The Bakery " + x + "\n",0.01) | |
StyleText("Please visit us again\n",0.01) | |
Answer1 = False | |
elif d == 'y' or d == 'yes': | |
while Answer2: | |
s = str | |
StyleText("Which of these recipes would you like to order, Chocolate Cupcakes or Lemon Drizzle Cake?\n",0.01) | |
s = input(":") | |
s = s.lower() | |
if s == 'chocolate cupcake' or s == 'chocolate cupcakes' or s == 'chocolate' or s == 'cupcakes': | |
Answer2 = False | |
string = str | |
goodanswer1 = True | |
a = int | |
StyleText("How many would you like to order?\n",0.01) | |
string = input(":") | |
while goodanswer1: | |
if string.isnumeric(): | |
goodanswer1 = False | |
a = int(string) | |
else: | |
StyleText("Please use numbers only\n",0.01) | |
a = input(":") | |
flour = (a * 120/10) | |
sugar = (a * 140/10) | |
butter = (a * 40/10) | |
eggs = (a * 1/10) | |
StyleText("The ingredients required for your order are:\n",0.01) | |
StyleText("Flour=" + str(flour) + "g\n",0.01) | |
StyleText("Sugar=" + str(sugar) + "g\n",0.01) | |
StyleText("Butter=" + str(butter) + "g\n",0.01) | |
StyleText("Eggs=" + str(eggs) + "eggs\n",0.01) | |
while Answer3: | |
b = str | |
StyleText("Would you also like to order Lemon Drizzle cakes (Yes or NO)\n",0.01) | |
b = input(":") | |
b = b.lower() | |
if b == 'y' or b == 'yes': | |
Answer3 = False | |
goodanswer2 = True | |
c = int | |
StyleText("How many would you like to order?\n",0.01) | |
string = input(":") | |
while goodanswer2: | |
if string.isnumeric(): | |
goodanswer2 = False | |
c = int(string) | |
else: | |
StyleText("Please use numbers only\n",0.01) | |
string = input(":") | |
flour2 = (c * 240) | |
sugar2 = (c * 300) | |
butter2 = (c * 80) | |
eggs2 = (c * 4.5) | |
StyleText("The ingredients required for your order are:\n",0.01) | |
StyleText("Flour=" + str(flour2) + "g\n",0.01) | |
StyleText("Sugar=" + str(sugar2) + "g\n",0.01) | |
StyleText("Butter=" + str(butter2) + "g\n",0.01) | |
StyleText("Eggs=" + str(eggs2) + "eggs\n",0.01) | |
elif b == 'n' or b == 'no': | |
Answer3 = False | |
flour2 = (0) | |
sugar2 = (0) | |
butter2 = (0) | |
eggs2 = (0) | |
else: | |
StyleText("Please choose either 'Yes' or 'No'\n",0.01) | |
Answer3 = True | |
print("*********************************************************************") | |
input("Press enter to proceed") | |
print("*********************************************************************") | |
StyleText("*\n",0.01) | |
StyleText("*\n",0.01) | |
StyleText("Thank you for ordering " + x + "\n",0.01) | |
StyleText("The total amount of ingredients for your order are:\n",0.01) | |
TF = (flour+flour2) | |
TS = (sugar+sugar2) | |
TB = (butter+butter2) | |
TE = (eggs+eggs2) | |
StyleText("Flour=" + str(TF) + "\n",0.01) | |
StyleText("Sugar=" + str(TS) + "\n",0.01) | |
StyleText("Butter=" + str(TB) + "\n",0.01) | |
StyleText("Eggs=" + str(TE) + "\n",0.01) | |
print("*********************************************************************") | |
input("Press enter to know the total number of bags you need") | |
print("*********************************************************************") | |
LF = 0 | |
MF = 0 | |
SF = 0 | |
FLOUR = str | |
FLOUR = TF | |
while FLOUR > 0: | |
if FLOUR >= 750: | |
LF += 1 | |
FLOUR += -750 | |
elif FLOUR >= 251 and FLOUR < 750: | |
MF += 1 | |
FLOUR += -500 | |
elif FLOUR <= 250: | |
SF += 1 | |
FLOUR += -250 | |
StyleText("*\n",0.01) | |
StyleText("*\n",0.01) | |
StyleText("The total needed number of bags for Flour are:\n",0.01) | |
StyleText(str(LF) + "Large Flour Bag(s)\n",0.01) | |
StyleText(str(MF) + "Medium Flour Bag\n",0.01) | |
StyleText(str(SF) + "Small Flour Bag\n",0.01) | |
LS = 0 | |
MS = 0 | |
SS = 0 | |
SUGAR = str | |
SUGAR = TS | |
while SUGAR > 0: | |
if SUGAR >= 600: | |
LS += 1 | |
SUGAR += -600 | |
elif SUGAR >= 201 and SUGAR < 600: | |
MS += 1 | |
SUGAR += -400 | |
elif SUGAR <= 200: | |
SS += 1 | |
SUGAR += -200 | |
StyleText("*\n",0.01) | |
StyleText("*\n",0.01) | |
StyleText("The total needed number of bags for Sugar are:\n",0.01) | |
StyleText(str(LS) + "Large Sugar Bag(s)\n",0.01) | |
StyleText(str(MS) + "Medium Sugar Bag\n",0.01) | |
StyleText(str(SS) + "Small Sugar Bag\n",0.01) | |
LB = 0 | |
MB = 0 | |
SB = 0 | |
BUTTER = str | |
BUTTER = TB | |
while BUTTER > 0: | |
if BUTTER >= 500: | |
LB += 1 | |
BUTTER += -500 | |
elif BUTTER >= 126 and BUTTER < 500: | |
MB += 1 | |
BUTTER += -250 | |
elif BUTTER <= 125: | |
SB += 1 | |
BUTTER += -125 | |
StyleText("*\n",0.01) | |
StyleText("*\n",0.01) | |
StyleText("The total needed number of bags for Butter are:\n",0.01) | |
StyleText(str(LB) + "Large Butter Bag(s)\n",0.01) | |
StyleText(str(MB) + "Medium Butter Bag\n",0.01) | |
StyleText(str(SB) + "Small Butter Bag\n",0.01) | |
LE = 0 | |
ME = 0 | |
SE = 0 | |
EGGS = str | |
EGGS = TE | |
while EGGS > 0: | |
if EGGS >= 12: | |
LE += 1 | |
EGGS += -12 | |
elif EGGS >= 7 and EGGS < 12: | |
ME += 1 | |
EGGS += -10 | |
elif EGGS <= 6: | |
SE += 1 | |
EGGS += -6 | |
StyleText("*\n",0.01) | |
StyleText("*\n",0.01) | |
StyleText("The total needed number of bags for Eggs are:\n",0.01) | |
StyleText(str(LE) + "Large Eggs Bag(s)\n",0.01) | |
StyleText(str(ME) + "Medium Eggs Bag\n",0.01) | |
StyleText(str(SE) + "Small Eggs Bag\n",0.01) | |
elif s == 'lemon cake' or s == 'lemon' or s == 'drizzle' or s == 'lemon drizzle' or s == 'lemon drizzle cake': | |
Answer2 = False | |
string = str | |
goodanswer3 = True | |
a = int | |
StyleText("How many would you like to order?\n",0.01) | |
string = input(":") | |
while goodanswer3: | |
if string.isnumeric(): | |
goodanswer3 = False | |
a = int(string) | |
else: | |
StyleText("Please use numbers only\n",0.01) | |
string = input(":") | |
flour = (a * 240) | |
sugar = (a * 300) | |
butter = (a * 80) | |
eggs = (a * 4.5) | |
StyleText("The ingredients required for your order are:\n",0.01) | |
StyleText("Flour=" + str(flour) + "g\n",0.01) | |
StyleText("Sugar=" + str(sugar) + "g\n",0.01) | |
StyleText("Butter=" + str(butter) + "g\n",0.01) | |
StyleText("Eggs=" + str(eggs) + "eggs\n",0.01) | |
while Answer4: | |
b = str | |
StyleText("Would you also like to order Chocolate Cupcakes (Yes or NO)\n",0.01) | |
b = input(":") | |
b = b.lower() | |
if b == 'y' or b == 'yes': | |
Answer4 = False | |
goodanswer = True | |
c = int | |
StyleText("How many would you like to order?\n",0.01) | |
string = input(":") | |
while goodanswer: | |
if string.isnumeric(): | |
goodanswer = False | |
c = int(string) | |
else: | |
StyleText("Please use numbers only\n",0.01) | |
string = input(":") | |
flour2 = (c * 120/10) | |
sugar2 = (c * 140/10) | |
butter2 = (c * 40/10) | |
eggs2 = (c * 1/10) | |
StyleText("The ingredients required for your order are:\n",0.01) | |
StyleText("Flour=" + str(flour2) + "g\n",0.01) | |
StyleText("Sugar=" + str(sugar2) + "g\n",0.01) | |
StyleText("Butter=" + str(butter2) + "g\n",0.01) | |
StyleText("Eggs=" + str(eggs2) + "eggs\n",0.01) | |
elif b == 'n' or b == 'no': | |
Answer4 = False | |
flour2 = (0) | |
sugar2 = (0) | |
butter2 = (0) | |
eggs2 = (0) | |
else: | |
StyleText("please choose either 'Yes' or 'No'\n",0.01) | |
Answer4 = True | |
print("*********************************************************************") | |
input("Press enter to proceed") | |
print("*********************************************************************") | |
StyleText("*",0.01) | |
StyleText("*",0.01) | |
StyleText("Thank you for ordering " + x + "\n",0.01) | |
StyleText("The total amount of ingredients for your order are:\n",0.01) | |
TF = (flour+flour2) | |
TS = (sugar+sugar2) | |
TB = (butter+butter2) | |
TE = (eggs+eggs2) | |
StyleText("Flour=" + str(TF) + "\n",0.01) | |
StyleText("Sugar=" + str(TS) + "\n",0.01) | |
StyleText("Butter=" + str(TB) + "\n",0.01) | |
StyleText("Eggs=" + str(TE) + "\n",0.01) | |
print("*********************************************************************") | |
input("Press enter to know the total number of bags you need") | |
print("*********************************************************************") | |
LF = 0 | |
MF = 0 | |
SF = 0 | |
FLOUR = str | |
FLOUR = TF | |
while FLOUR > 0: | |
if FLOUR >= 750: | |
LF += 1 | |
FLOUR += -750 | |
elif FLOUR >= 251 and FLOUR < 750: | |
MF += 1 | |
FLOUR += -500 | |
elif FLOUR <= 250: | |
SF += 1 | |
FLOUR += -250 | |
StyleText("*\n",0.01) | |
StyleText("*\n",0.01) | |
StyleText("The total needed number of bags for Flour are:\n",0.01) | |
StyleText(str(LF) + "Large Flour Bag(s)\n",0.01) | |
StyleText(str(MF) + "Medium Flour Bag\n",0.01) | |
StyleText(str(SF) + "Small Flour Bag\n",0.01) | |
LS = 0 | |
MS = 0 | |
SS = 0 | |
SUGAR = str | |
SUGAR = TS | |
while SUGAR > 0: | |
if SUGAR >= 600: | |
LS += 1 | |
SUGAR += -600 | |
elif SUGAR >= 201 and SUGAR < 600: | |
MS += 1 | |
SUGAR += -400 | |
elif SUGAR <= 200: | |
SS += 1 | |
SUGAR += -200 | |
StyleText("*\n",0.01) | |
StyleText("*\n",0.01) | |
StyleText("The total needed number of bags for Sugar are:\n",0.01) | |
StyleText(str(LS) + "Large Sugar Bag(s)\n",0.01) | |
StyleText(str(MS) + "Medium Sugar Bag\n",0.01) | |
StyleText(str(SS) + "Small Sugar Bag\n",0.01) | |
LB = 0 | |
MB = 0 | |
SB = 0 | |
BUTTER = str | |
BUTTER = TB | |
while BUTTER > 0: | |
if BUTTER >= 500: | |
LB += 1 | |
BUTTER += -500 | |
elif BUTTER >= 126 and BUTTER < 500: | |
MB += 1 | |
BUTTER += -250 | |
elif BUTTER <= 125: | |
SB += 1 | |
BUTTER += -125 | |
StyleText("*\n",0.01) | |
StyleText("*\n",0.01) | |
StyleText("The total needed number of bags for Butter are:\n",0.01) | |
StyleText(str(LB) + "Large Butter Bag(s)\n",0.01) | |
StyleText(str(MB) + "Medium Butter Bag\n",0.01) | |
StyleText(str(SB) + "Small Butter Bag\n",0.01) | |
LE = 0 | |
ME = 0 | |
SE = 0 | |
EGGS = str | |
EGGS = TE | |
while EGGS > 0: | |
if EGGS >= 12: | |
LE += 1 | |
EGGS += -12 | |
elif EGGS >= 7 and EGGS < 12: | |
ME += 1 | |
EGGS += -10 | |
elif EGGS <= 6: | |
SE += 1 | |
EGGS += -6 | |
StyleText("*\n",0.01) | |
StyleText("*\n",0.01) | |
StyleText("The total needed number of bags for Eggs are:\n",0.01) | |
StyleText(str(LE) + "Large Eggs Bag(s)\n",0.01) | |
StyleText(str(ME) + "Medium Eggs Bag\n",0.01) | |
StyleText(str(SE) + "Small Eggs Bag\n",0.01) | |
else: | |
StyleText("This recipe is not correct...\n",0.01) | |
StyleText("Please chose either Chocolate cupcakes or Lemon Drizzle cake\n",0.01) | |
Answer2 = True | |
Answer1 = False | |
else: | |
StyleText("Please choose either Yes or No\n",0.01) | |
Answer1 = True | |
time.sleep(30) |