Commit 402fc1dd by BellCodeEditor

save project

parent 1bb333ec
Showing with 18 additions and 4 deletions
a=[] def new_input():
while True: a=[]
while True:
b=input("请输入:") b=input("请输入:")
if b=="q": if b=="q":
...@@ -11,4 +12,18 @@ while True: ...@@ -11,4 +12,18 @@ while True:
print("请输入整数") print("请输入整数")
else: else:
a.append(b) a.append(b)
print(a) return a
\ No newline at end of file
def sum(money):
count=0
for i in money:
count=count+i
return count
price=new_input()
pay=sum(price)
print("您一共消费了"+str(pay)+"元")
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