diff --git a/__pycache__/func.cpython-37.pyc b/__pycache__/func.cpython-37.pyc new file mode 100644 index 0000000..77182e8 Binary files /dev/null and b/__pycache__/func.cpython-37.pyc differ diff --git a/__pycache__/sss.cpython-37.pyc b/__pycache__/sss.cpython-37.pyc new file mode 100644 index 0000000..61fb511 Binary files /dev/null and b/__pycache__/sss.cpython-37.pyc differ diff --git a/func.py b/func.py new file mode 100644 index 0000000..cabd8f2 --- /dev/null +++ b/func.py @@ -0,0 +1,20 @@ +def new_input(): + total = [] + while True: + money= input("请输入:") + if money== 'q': + break + else: + try: + money = int(money) + except: + print("请输入一个数字") + else: + total.append(money) + finally: + print("-"*30) + return total + + +result = new_input() +print(result) \ No newline at end of file diff --git a/sss.py b/sss.py new file mode 100644 index 0000000..4ca4469 --- /dev/null +++ b/sss.py @@ -0,0 +1,4 @@ +import func + +data = func.new_input() +score = func.sum(data) \ No newline at end of file