Commit e66f8425 by BellCodeEditor

auto save

parent 17bd6bc5
Showing with 11 additions and 10 deletions
def totalnum(): def jkun():
total = [] jikun = []
num =0
while True: while True:
unit= input("请输入:") unit= input("请输入:")
if unit== 'q': if unit== 'q':
break break
else: else:
total.append(int(unit)) try:
print(total) new_input = int(unit)
for i in total: except(ValueError):
num = i+ num print("请输入一个整数")
print("本次消费:"+str(num)+"元") else:
totalnum() jikun.append(new_input)
\ No newline at end of file print(jikun)
jkun()
\ 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