diff --git a/func.py b/func.py new file mode 100644 index 0000000..8a5db89 --- /dev/null +++ b/func.py @@ -0,0 +1,24 @@ +def abc(): + total = [] + while True: + unit= input("请输入:") + if unit== 'q': + break + else: + try: + unit = int(unit) + except: + print("请输入整数") + else: + total.append(unit) + return total +a=abc() +print(a) + +def sum(num): + count=0 + for i in num: + count=count+1 + return count +pay = sum(a) +print(pay)