Commit 7446511e by BellCodeEditor

auto save

parent 7dbc1479
def func1():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
price = input("请输入整数:")
if price== 'q':
break
else:
total.append(unit)
print(total)
try:
a = int(price)
except:
print("请输入整数")
else:
total.append(a)
return total
def count1(a):
sum=0
for i in a:
sum=sum+i
return sum
func1()
\ No newline at end of file
# result=func1()
# print(result)
# s=count1(result)
# print("总数是:"+str(s))
\ No newline at end of file
import func
a=func.func1()
b=func.count1(a)
print("总数是:"+str(b))
\ 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