Commit af4483c1 by BellCodeEditor

save project

parent e12b8870
Showing with 24 additions and 15 deletions
total = []
def new_input(unit):
return int(unit)
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
try:
unit = int(unit)
except:
print("使用有误")
def mysum(list):
sum=0
for n in list:
sum+=n
return sum
def new_input():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
total.append(unit)
print(total)
\ No newline at end of file
try:
unit = int(unit)
except:
print("使用有误")
else:
total.append(unit)
print(mysum(total))
new_input()
\ 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