Commit 7c5d244a by BellCodeEditor

save project

parent a346e611
Showing with 19 additions and 5 deletions
def a(): def a():
b=[] b=[]
while True: while True:
c=input("您的菜品名称是什么:") c=input("您的菜品价格(按‘d’退出):")
if c=="d": if c=="d":
break break
else: else:
b.append(c) try:
print(b) c=int(c)
a() except:
\ No newline at end of file print('请输入整数!!!!!!!!')
else:
b.append(c)
print("-"*30)
return b
def f(g):
h=0
for i in g:
h=h+i
return h
e=a()
print(e)
j=f(e)
print("共消费:"+str(j))
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment