[python]代码库
import time
# 列表
print('python启动中...')
time.sleep(5.0)
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}
def diancai():
print('点菜程序启动中...')
time.sleep(5.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('输入错误!')
def tiaoshi():
print('调试启动中...')
time.sleep(5.0)
print('调试')
print('================')
print('1.换菜')
print('功能陆续开发中...')
print('================')
s = input('选项:')
if s =='1':
print(l)
b = input('输入要替换的菜品')
if b in l:
g = input('输入新菜品')
d = l.index(b)
l[d] = g
print(l)
else:
print('NO')
while True:
sk = input('输入功能:1点菜2.调试3.退出')
if sk == '1':
diancai()
elif sk = =‘2’
tiaoshi()
elif sk == '3':
break
else:
print('输入错误!')