急急急!求大神帮忙做个Python在线点餐小软件

2024-11-08 19:50:53
推荐回答(3个)
回答(1):

User={}
List=open("USER.txt","r")
for _list in List:
_List=_list.split()
User[_List[0]]=_list[2]
List.close()
List1=open("USER.txt","a")
print ("Welcome")
print ("是否需要注册?(Y/N):")
a1=True
while a1:
_a=input("请输入选择:")
if _a not in ["Y","y","N","n"]:
print ("WARRING:请输入Y或者N进行选择")
continue
else:
a1=False
a1=True
if _a in ["Y","y"]:
print ("----------------注册界面----------------")
while a1:
a_id=input("请输入ID:")
if a_id in User:
print ("ID被占用,请重新输入!")
continue
else:
while a1:
a_pass=input("请输入密码:")
a_pass1=input("请再次输入密码:")
if a_pass!=a_pass1:
print ("两次密码不正确!重新输入")
continue
else:

List1.write(a_id)
List1.write("\t")
List1.write(a_pass)
List1.write("\n")
print ("注册完毕,将转入登录界面!")
a1=False

else:
None
List1.close()
print ("----------------登录界面----------------")
a1=True
while a1:
b1=input("请输入账号:")
b2=input("请输入密码:")
try:
User[b1]
except:
print ("账号错误,请重新输入!")
continue
if User[b1]!=b2:
print ("账号密码输入错误,请重新输入!")
continue
else:
a1=False
print ("----------------点餐界面----------------")
print ("1:茄子 10元\n2:白菜:15元\n3:萝卜:20元\n4:肉:30元")
Dict={"1":"茄子","2":"白菜","3":"萝卜","4":"肉"}
Price={"1":10,"2":15,"3":20,"4":30}
print ("请输入要点的菜编号(没输入一份菜请按一次回车):")
a1=True
_a1=1
az=[]
while a1:
ax=input("第%s份(点Q退出点餐):" %(_a1))
if ax=="q" or ax=="Q":
print ("结束点餐!!!")
a1=False
elif ax not in ["1","2","3","4"]:
print ("未开发餐内容!,请重新输入")
continue
else:
az.append(ax)
_a1+=1
a1=True
total=0
while a1:
if az==[]:
print ("您没有点餐!!!!,退出点餐系统!!!")
a1=False
else:
print ("您的餐列表:")
for zz in az:
print ("%s\t%s" %(Dict[zz],Price[zz]))
total+=Price[zz]
print ("一共%s元" %(total))
a1=False
print ("欢迎下次光临!!")

需要Python3以上 不然自己去改print
在PYTHON所在文件夹里做一个USER.txt 用来存储账号密码用

回答(2):

先给500后加1000可以有

回答(3):

自己做吧。已解决,请采纳