Commit 45f60082 by BellCodeEditor

save project

parent 24031b67
Showing with 20 additions and 8 deletions
def new_input():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
try:
unit=int(unit)
except:
print("请重新输入一个数字")
else:
total.append(unit)
print("-"*40)
return new_input
result=new_input()
print(result)
\ No newline at end of file
...@@ -12,12 +12,6 @@ def new_input(): ...@@ -12,12 +12,6 @@ def new_input():
else: else:
total.append(unit) total.append(unit)
print("-"*40) print("-"*40)
return total return new_input
def sum(money):
count=0
for i in money:
count=count+i
return count
result=new_input() result=new_input()
pay=sum(result) print(result)
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