[python]代码库
# 列表
c = []
l = ['蛋糕','红烧李中男' ,'烧烤','火锅','麻辣烫','炕土豆','红烧茄子','四川麻辣面','李中男鸡汤','黑米粥' ,'毒鸡汤','可乐','美年达','肥肠','菠萝啤','红牛','二锅头','凉面','豆奶','爆炒李中男鸡','李中男烧烤','红牛']
# 价格
j = 0
p = {'李中男鸡汤':45.78,'烧烤李中男':5.0,'蛋糕':10.8,'红烧李中男':45.78,'烧烤':13.8,'火锅':123.0,'麻辣烫':56.2,'炕土豆':9.0,'红烧茄子':24.0,'四川麻辣面':37.0,'毒鸡汤':48.0,'黑米粥':5.0,'可乐':3.0,'美年达':4.0,'肥肠':43.50,'菠萝啤':7.0,'二锅头':80.0,'红牛':5.0,'凉面':20.0,'豆奶':2.5,'李中男烧烤':0.00,'爆炒李中男鸡':20.0}
while True:
b = ''
j = 0
print('本店的菜品是' , l)
print('======================')
print('1. 点菜')
print('2. 结账')
print('3. 查看已点菜')
print('4. 替换菜品')
print('======================')
a = input('输入选项:')
if a == '1':
print('======================')
b = input('输入要点的菜:')
if b in l:
c.append(b)
else:
print('没有这道菜~')
print('======================')
elif a == '2':
print('======================')
print('已经点了' + str(c))
for i in c:
j = j + p[i]
print('价格是:' + str(j) + '元')
print('再见~~')
print('======================')
break
elif a == '3':
print('======================')
print(c)
print('======================')
elif a == '4':
print('======================')
b = input('输入要替换的菜品')
if b in c:
g = input('输入新菜品')
d = c.index(b)
c[d] = g
print('你已经点的菜是:', c)
print('======================')
else:
print('======================')
print('没有这道菜,你已经点的菜品是:',c)
print('======================')
else:
print('输入错误!')