Commit 15bbe2c7 by BellCodeEditor

save project

parent da3600a4
Showing with 48 additions and 0 deletions
def new_input():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
try:
price=int(unit)
except:
print("输入整数哦")
else:
total.append(price)
print(total)
return total
def sum_a(list_a):
sumnum=0
for i in list_a:
sumnum+=i
return sumnum
a=new_input()
b=sum_a(a)
print(sumnum)
def new_input():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
try:
price=int(unit)
except:
print("输入整数哦")
else:
total.append(price)
print(total)
return total
a=new_input()
sumnum=0
for i in a:
sumnum+=i
print(sumnum)
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