Commit 6b1d4280 by BellCodeEditor

auto save

parent 4b1e2cc0
try: import func
age = int(input("你今年几岁"))
except: list1 = func.new_input()
print('要输入整数') print(func.sum(list1))
print("程序结束")
\ No newline at end of file
def hello(name):
content = "你好" + name
return content
result = hello("小易")
print(result)
def func(): def new_input():
total = [] total = []
while True: while True:
try: try:
...@@ -9,6 +9,14 @@ def func(): ...@@ -9,6 +9,14 @@ def func():
total.append(int(unit)) total.append(int(unit))
except: except:
print("只能输入数字或q") print("只能输入数字或q")
print(total) return total
func() def sum(money):
count = 0
for i in money:
count += i
return count
# list1 = new_input()
# result = sum(list1)
# print(result)
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