Commit 84633d78 by BellCodeEditor

save project

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