Python 存储函数 导入系统 打印(“你好,我是FoodBot,欢迎来到Fire n'Fusion。请在每个类别中选择您的商品。”) 打印(“当我要求您选择时,请输入菜单项的代码。”) menuname=str(输入(“您希望订单的名称:”)) questionin
存储函数 导入系统 打印(“你好,我是FoodBot,欢迎来到Fire n'Fusion。请在每个类别中选择您的商品。”) 打印(“当我要求您选择时,请输入菜单项的代码。”) menuname=str(输入(“您希望订单的名称:”)) questioninput=int(输入(“您想在这里吃饭还是要点菜?输入1表示在这里吃饭,输入2表示您想吃饭:”) 如果questioninput<1或questioninput>2: sys.exit(“很抱歉,您的输入有错误。请重试!”) 打印(“这是开胃菜…”) 打印(-------------------------------------) 打印(“蜂蜜辣椒土豆($3.20)-使用代码1”) 打印(“Paneer莴苣卷($5.10)-使用代码2”) 打印(“迷你鸡肉玉米卷($3.55)-使用代码3”) 打印(“火热鸡肉丸子($5.99)-使用代码4”) 打印(“无需输入5”) 开胃菜输入=int(输入(“在开胃菜[Code=1-5]:”中输入您想要的内容) 如果开胃菜量==1: 项目价格应用=3.20 elif开胃食品量==2: 项目价格应用=5.10 elif开胃食品量==3: 项目价格应用=3.55 elif开胃食品量==4: 项目价格应用=5.99 elif开胃食品量==5: 项目价格应用=0.00 elif开胃菜量<1或开胃菜量>5: sys.exit(“很抱歉,您的输入有错误。请重试!”) 打印(“主菜在这里…”) 打印(-------------------------------------) 打印(“Gobi Munchurian($7.21)-使用代码6”) 打印(“烤蔬菜串($5.33)-使用代码7”) 打印(“Paneer Kathi Rolls($7.79)-使用代码8”) 打印(“柠檬姜鸡($8.60)-使用代码9”) 打印(“热鸡千层面($6.45)-使用代码10”) 打印(“Prisha最喜欢的鸡肉奶酪馅饼($7.84)-使用代码11”) 打印(“无需输入12”) entreInput=int(输入(“在entres中输入您想要的内容[代码6-12]:”) 如果EntereInput==6: 项目价格=7.21 elif EntereInput==7: 项目价格=5.33 elif EntereInput==8: 项目价格=7.79 elif EntereInput==9: 项目价格=8.60 elif EntereInput==10: 项目价格=6.45 elif EntereInput==11: 项目价格=7.84 elif EntereInput==12: 项目价格=0.00 elif输入小于6或输入大于12: sys.exit(“很抱歉,您的输入有错误。请重试!”) 打印(“这是面包和米饭的选择……”) 打印(-------------------------------------) 打印(“孜然米(2.25美元)-使用代码13”) 打印(“鸡蛋弗里德里斯(3.25美元)-使用代码14”) 打印(“普通库尔卡($1.50)-使用代码15”) 打印(“AlooKulcha($2.25)-使用代码16”) 打印(“无需输入17”) breadRiceInput=int(输入(“在面包和米饭中输入您想要的内容[代码13-17]:”) 如果breadRiceInput==13: 项目价格=2.25 elif breadandriceinput==14: 项目价格=3.25 elif breadandriceinput==15: 项目价格=1.50 elif breadandriceinput==16: 项目价格=2.25 elif breadandriceinput==17: 项目价格=0.00 elif面包和大米输入<13或面包和大米输入>17: sys.exit(“很抱歉,您的输入有错误。请重试!”) 打印(“这是甜点的选择…”) 打印(-------------------------------------) 打印(“阿拉伯国王糖果($3.99)-使用代码18”) 打印(“椰子炒冰淇淋($2.50)-使用代码19”) 打印(“最高香草软糖($3.75)-使用代码20”) 打印(“无需输入21”) 甜品输入=int(输入(“在甜品中输入您想要的[代码18-21]:”) 如果甜点输入=18: 项目价格=3.99 elif dessertinput==19: 项目价格=2.50 elif dessertinput==20: 项目价格=3.75 elif dessertinput==21: 项目价格=0.00 elif甜点输入<18或甜点输入>21: sys.exit(“很抱歉,您的输入有错误。请重试!”) 打印(“这是饮料的选择…”) 打印(-------------------------------------) 打印(“柴($1.00)-使用代码22”) 打印(“饼干和奶油奶昔($2.50)-使用代码23”) 打印(“瓶装水($1.25)-使用代码24”) 打印(“喷泉场($1.50)-使用代码25”) 打印(“无需输入26”) drinkinput=int(输入(“输入您想要的饮料[代码22-26]:”) 如果drinkinput==22: 项目价格dri=1.00 elif drinkinput==23: 项目价格dri=2.50 elif drinkinput==24: 项目价格dri=1.25 elif drinkinput==25: 项目价格dri=1.50 elif drinkinput==26: 项目价格dri=0.00 elif drinkinput<22或drinkinput>26: sys.exit(“很抱歉,您的输入有错误。请重试!”) sauceinput=str(输入(“您想在用餐时放一个酱汁拼盘(输入是或否)吗?”):) def mybill(): 打印(“”) 打印(“”) 打印(“”) 打印(“”) 打印(“----火与熔合----”) 如果questioninput==1: 打印(“用餐:在餐厅用餐”) elif questioninput==2: 打印(“用餐:待办订单”) 如果开胃菜量==1: 印刷品(“蜂蜜辣椒土豆:“+”$3.20”) elif开胃食品量==2: 打印(“Paneer莴苣卷:“+”$5.10”) elif开胃食品量==3: 打印(“迷你鸡肉玉米粉蒸肉:“+”$3.55”) elif开胃食品量==4: 打印(“火热鸡肉丸子:“+”$5.99”) 如果EntereInput==6: 印刷品(“戈壁芒楚良:“+”$7.21”) elif EntereInput==7: 印刷(“烤蔬菜串:“+”$5.33”) elif EntereInput==8: 打印(“Paneer Kathi Rolls:“+”$7.79”) elif EntereInput==9: 印刷品(“柠檬姜鸡:“+”$8.60”) elif EntereInput==10: 打印(“热鸡千层面:“+”$6.45”) elif EntereInput==11: 打印(“普里沙最喜欢的鸡肉和奶酪馅饼:“+”$7.84”) 如果breadRiceInput==13: 印刷品(“孜然米:“+”$2.25”) elif breadandriceinput==14: 印刷品(“鸡蛋炒饭:“+”$3.25”) elif breadandriceinput==15: PPython 存储函数 导入系统 打印(“你好,我是FoodBot,欢迎来到Fire n'Fusion。请在每个类别中选择您的商品。”) 打印(“当我要求您选择时,请输入菜单项的代码。”) menuname=str(输入(“您希望订单的名称:”)) questionin,python,Python,存储函数 导入系统 打印(“你好,我是FoodBot,欢迎来到Fire n'Fusion。请在每个类别中选择您的商品。”) 打印(“当我要求您选择时,请输入菜单项的代码。”) menuname=str(输入(“您希望订单的名称:”)) questioninput=int(输入(“您想在这里吃饭还是要点菜?输入1表示在这里吃饭,输入2表示您想吃饭:”) 如果questioninput2: sys.exit(“很抱歉,您的输入有错误。请重试!”) 打印(“这是开胃菜…”) 打印(----------
import sys
print("Hello I am FoodBot, welcome to Fire n' Fusion. Please choose your item in each category.")
print("When I ask for your choices enter the code of the menu item.")
menuname= str(input("What is the name you would like your order placed under:"))
questioninput= int(input("Would like to eat here or would you like your order to-go? Enter 1 for eating here and 2 if you would like your meal to-go:"))
if questioninput < 1 or questioninput > 2:
sys.exit("Sorry there was an error in your input. Please retry!")
print("Here are the appetizers...")
print("-------------------------------")
print("Honey Chilli Potatoes($3.20) - Use Code 1")
print("Paneer Lettuce Wraps($5.10) - Use Code 2")
print("Mini Chicken Tamales($3.55) - Use Code 3 ")
print("Fiery Chicken Meatballs($5.99) - Use Code 4")
print("Enter 5 for Nothing")
appetizerinput = int(input("Enter what you would like in APPETIZERS[Code = 1-5]: "))
if appetizerinput == 1:
item_price_app = 3.20
elif appetizerinput == 2:
item_price_app = 5.10
elif appetizerinput == 3:
item_price_app = 3.55
elif appetizerinput == 4:
item_price_app = 5.99
elif appetizerinput == 5:
item_price_app = 0.00
elif appetizerinput < 1 or appetizerinput > 5:
sys.exit("Sorry there was an error in your input. Please retry!")
print("Here are the Entrees...")
print("-------------------------------")
print("Gobi Munchurian($7.21) - Use Code 6")
print("Grilled Veggie Skewers($5.33) - Use Code 7")
print("Paneer Kathi Rolls($7.79) - Use Code 8")
print("Lemon and Ginger Chicken($8.60) - Use Code 9")
print("Hot Chicken Lasagna($6.45) - Use Code 10")
print("Prisha's Favorite Chicken n'Cheese Enchiladas ($7.84) - Use Code 11")
print("Enter 12 for Nothing")
entreeinput = int(input("Enter what you would like in ENTREES [Code 6-12]:"))
if entreeinput == 6:
item_price_ent = 7.21
elif entreeinput == 7:
item_price_ent = 5.33
elif entreeinput == 8:
item_price_ent = 7.79
elif entreeinput == 9:
item_price_ent = 8.60
elif entreeinput == 10:
item_price_ent = 6.45
elif entreeinput == 11:
item_price_ent = 7.84
elif entreeinput == 12:
item_price_ent = 0.00
elif entreeinput < 6 or entreeinput > 12:
sys.exit("Sorry there was an error in your input. Please retry!")
print("Here are the Choices for Bread and Rice...")
print("-------------------------------")
print("Cumin Rice($2.25) - Use Code 13")
print("Egg Friedrice($3.25) - Use Code 14")
print("Plain Kulcha($1.50) - Use Code 15")
print("AlooKulcha($2.25) - Use Code 16")
print("Enter 17 for Nothing")
breadandriceinput = int(input("Enter what you would like in BREAD AND RICE [Code 13-17]:"))
if breadandriceinput == 13:
item_price_brice = 2.25
elif breadandriceinput == 14:
item_price_brice = 3.25
elif breadandriceinput == 15:
item_price_brice = 1.50
elif breadandriceinput == 16:
item_price_brice = 2.25
elif breadandriceinput == 17:
item_price_brice = 0.00
elif breadandriceinput < 13 or breadandriceinput > 17:
sys.exit("Sorry there was an error in your input. Please retry!")
print("Here are the Choices for Desserts...")
print("-------------------------------")
print("Arabic King-Sweets($3.99) - Use Code 18")
print("Coconut Fried IceCream($2.50) - Use Code 19")
print("Supreme Vanilla Fudge($3.75) - Use Code 20")
print("Enter 21 for Nothing")
dessertinput = int(input("Enter what you would like in DESSERTS [Code 18-21]:"))
if dessertinput == 18:
item_price_des = 3.99
elif dessertinput == 19:
item_price_des = 2.50
elif dessertinput == 20:
item_price_des = 3.75
elif dessertinput == 21:
item_price_des = 0.00
elif dessertinput < 18 or dessertinput > 21:
sys.exit("Sorry there was an error in your input. Please retry!")
print("Here are the Choices for Drinks...")
print("-------------------------------")
print("Chai($1.00) - Use Code 22")
print("Cookies n' Cream Milkshake($2.50) - Use Code 23")
print("Bottle of Water($1.25) - Use Code 24")
print("FountainDrink($1.50) - Use Code 25")
print("Enter 26 for Nothing")
drinkinput = int(input("Enter what you would like in DRINKS [Code 22-26]:"))
if drinkinput == 22:
item_price_dri = 1.00
elif drinkinput == 23:
item_price_dri = 2.50
elif drinkinput == 24:
item_price_dri = 1.25
elif drinkinput == 25:
item_price_dri = 1.50
elif drinkinput == 26:
item_price_dri = 0.00
elif drinkinput < 22 or drinkinput > 26:
sys.exit("Sorry there was an error in your input. Please retry!")
sauceinput = str(input("Would you like a sauce platter with your meal(enter Yes or No)FREE!:"))
def mybill():
print(" ")
print(" ")
print(" ")
print(" ")
print(" -----Fire n' Fusion------")
if questioninput == 1:
print("Meal:EATING IN THE RESTARAUNT")
elif questioninput == 2:
print("Meal:TO-GO ORDER")
if appetizerinput == 1:
print("Honey Chilli Potatoes: " + " $3.20")
elif appetizerinput == 2:
print("Paneer Lettuce Wraps: " + " $5.10")
elif appetizerinput == 3:
print("Mini Chicken Tamales: " + " $3.55")
elif appetizerinput == 4:
print("Fiery Chicken Meatballs: " + " $5.99")
if entreeinput == 6:
print("Gobi Munchurian: " + " $7.21")
elif entreeinput == 7:
print("Grilled Veggie Skewers: " + " $5.33")
elif entreeinput == 8:
print("Paneer Kathi Rolls: " + " $7.79")
elif entreeinput == 9:
print("Lemon and Ginger Chicken: " + " $8.60")
elif entreeinput == 10:
print("Hot Chicken Lasagna: " + " $6.45")
elif entreeinput == 11:
print("Prisha's Favorite Chicken n' Cheese Enchiladas:" + "$7.84")
if breadandriceinput == 13:
print("Cumin Rice: " + " $2.25")
elif breadandriceinput == 14:
print("Egg Fried Rice: " + " $3.25")
elif breadandriceinput == 15:
print("Plain Kulcha: " + " $1.50")
elif breadandriceinput == 16:
print("Aloo Kulcha: " + " $2.25")
if dessertinput == 18:
print("King-Sweets: " + " $3.75")
elif dessertinput == 19:
print("Coconut Fried Ice Cream: " + " $2.50")
elif dessertinput == 20:
print("Supreme Vanilla Fudge: " + " $3.75")
if drinkinput == 22:
print("Chai: " + " $1.00")
elif drinkinput == 23:
print("Cookies n' Cream Milkshake:" + "$2.50")
elif drinkinput == 24:
print("Bottle of Water: " + " $1.25")
elif drinkinput == 25:
print("Fountain Drink: " + " $2.50")
totalcost = round(item_price_app + item_price_ent + item_price_brice + item_price_des + item_price_dri, 2)
print("Order Name:" + menuname)
print(" Total:" + str (totalcost))
taxresult = round(totalcost*0.0775, 2)
print(" Tax:" + str (taxresult))
mysubtotal = round(totalcost+taxresult, 2)
print(" Subtotal:" + str (mysubtotal))
print("-------HEAD TO THE CASHIER TO PAY-------")
print(" --Thank you For Choosing Fire n' Fusion--")
print(" *********ENJOY YOUR MEAL!*********" )
mybill()
def mybill():
with open("bill.txt", "a") as mybillfile:
# use following structure for every print statement
str = " -----Fire n' Fusion------"
myfile.write(str)
print(str)
import datetime
now = datetime.datetime.now()
receipt_file= open("Receipts.csv", 'a')
receipt_file.write(str(now.year) +',' + str(now.month) + ',' str(now.day) + ',' + str(total_cost))
receipt_file.close()
receipt_file= open("Receipts.csv", 'r')
for line in receipt_file.readlines():
year = line.split(',')[0]
month = line.split(',')[1]
# And so on - maybe even add list of receipts found with given criteria?
sales = {date1: {sale1:[], sale2:[]..., date2: {sale1:[], sale2:[]...}
import pickle
import datetime as dt
# define today's date
heute = dt.date.today()
with open('data.p', 'rb') as fid:
data = pickle.load(fid)
# when adding data to your dictionary
if heute not in data:
data[heute] = {}
# add sale
item = 'soup'
cost = 5.60
quantity = 4
salenum = 'sale' + str(len(data[heute]) + 1)
data[heute][salenum] = {}
data[heute][salenum][item] = {}
data[heute][salenum][item]['cost'] = cost
data[heute][salenum][item]['quantity'] = quantity
# store data to pickle
with open('data.p', 'wb') as fid:
pickle.dump(data, fid)
with open('data.p', 'rb') as fid:
data = pickle.load(fid)
# specify date of interest
doi = dt.date(2017, 1, 1)
if doi not in data:
print('No sales today!')
else:
for sale in sorted(data[doi]):
for item in data[doi][sale]:
print(item + 'x' + data[doi][sale][item]['quantity'] + ' @ $' + data[doi][sale]['cost'] + ' each')