Commit 84633d78 by BellCodeEditor

save project

parent bc1b7a94
def new_input(): def new_input():
total = [] total = []
while True: while True:
try: unit = input("请输入(按q退出):")
unit= int(input("请输入:"))
except:
print("请输入数字!")
print("-"*30)
else:
total.append(unit)
if unit== 'q': if unit== 'q':
break break
print(total) else:
new_input() try:
\ No newline at end of file unit= int(unit)
except:
print("请输入数字!")
print("-"*30)
else:
total.append(unit)
return total
def sum(money):
count = 0
for i in money:
count = count+i
return count
# a = new_input()
# result = sum(a)
# print(result)
\ No newline at end of file
import func
import func
a = func.new_input()
b = func.sum(a)
print(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