diff --git a/__pycache__/func.cpython-37.pyc b/__pycache__/func.cpython-37.pyc new file mode 100644 index 0000000..edeb6d6 Binary files /dev/null and b/__pycache__/func.cpython-37.pyc differ diff --git a/a.py b/a.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/a.py diff --git a/func.py b/func.py new file mode 100644 index 0000000..b698d39 --- /dev/null +++ b/func.py @@ -0,0 +1,27 @@ +def new_input(): + total = [] + while True: + unit=input("请输入:") + if unit== 'q': + break + else: + try: + unit =int(unit) + except: + print('请输入整数') + else: + total.append(unit) + return total + +b=new_input() +print(b) + + + +def sum(money): + c=0 + for i in money: + c+=i + return c +d=sum(b) +# print('您一共消费了'+int(d)+'元,扫码还是现金呢?') \ No newline at end of file