Commit df7ed05c by BellCodeEditor

auto save

parent 578e41ee
import func
a=func.new_input()
b=func.sum_a(a)
print(b)
\ No newline at end of file
total = []
while True:
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:
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(b)
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