Commit 9ec13607 by BellCodeEditor

save project

parent 97b86727
Showing with 54 additions and 14 deletions
def new_input():
a=[]
while True:
b=input("请输入菜品价格:")
if b=='q':
break
else:
try:
b=int(b)
except:
print("请重新输入一个数字")
else:
a.append(b)
finally:
print("========")
return a
def sum(money):
count =0
for i in money:
count=count+i
return count
# price=new_input()
# pay=sum(price)
# print("您一共消费了"+str(pay)+"元!扫码还是现金呢?")
\ No newline at end of file
filel=open(r"C:\Users\lenovo\Desktop\xxxx.txt",'a',encoding='utf-8')
filel=open(r"C:\Users\lenovo\Desktop\xxxx.txt",'a',encoding='utf-8')
filel.write('小兰:12本\n')
filel.write('随机:12本\n')
filel.write('小明:11本\n')
filel.close()
\ No newline at end of file
def new_input():
def new_input():
def new_input():
a=[]
while True:
try:
b=input("请输入菜品价格:")
if b=='q':
break
b=int(b)
except:
print("请输入数字:")
b=input("请输入菜品价格:")
if b=='q':
break
else:
a.append(b)
return a
result=new_input(a)
print(result)
\ No newline at end of file
try:
b=int(b)
except:
print("请重新输入一个数字")
else:
a.append(b)
finally:
print("========")
return a
def sum(money):
count =0
for i in money:
count=count+i
return count
price=new_input()
pay=sum(price)
print("您一共消费了"+str(pay)+"元!扫码还是现金呢?")
\ 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