Commit 7446511e by BellCodeEditor

auto save

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