Commit 5e8b7325 by BellCodeEditor

save project

parent 6ca89a8c
Showing with 13 additions and 6 deletions
...@@ -4,14 +4,21 @@ def new_input(): ...@@ -4,14 +4,21 @@ def new_input():
unit= input("请输入:") unit= input("请输入:")
if unit== 'q': if unit== 'q':
break break
else:
try: try:
hss=int(unit) unit1=int(unit)
except: except:
print('请输入数字') print('请输入数字')
else: else:
total.append(unit) total.append(unit)
print(total) finally:
print('===========')
return total return total
new_input() def sum(money):
re=new_input() count=0
print(re) for i in money:
\ No newline at end of file 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