diff --git a/func.py b/func.py new file mode 100644 index 0000000..63f5a32 --- /dev/null +++ b/func.py @@ -0,0 +1,24 @@ +def jjjjjjj(): + total = [] + while True: + unit = input('请输入:') + if unit == "q": + break + try: + unit = int(unit) + except: + print('请输入整数.') + else: + total.append(unit) + return total + +def b(m): + a = 0 + for i in m: + a+=i + return a + +x = jjjjjjj() +z = b(x) + +print('总价是',z) \ No newline at end of file