From e55e15d1ad1962ca8c5e7968abefaa6ae6b8b40b Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Mon, 26 Jul 2021 17:05:37 +0800 Subject: [PATCH] save project --- func.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 func.py diff --git a/func.py b/func.py new file mode 100644 index 0000000..e9b1db6 --- /dev/null +++ b/func.py @@ -0,0 +1,22 @@ +total = [] + +def new_input(): + while True: + unit= input("请输入:") + if unit== 'q': + break + else: + try: + int(unit) + except: + print('请输入数字!') + else: + total.append(unit) + print('加入成功') + + return total +n = new_input() +a = 0 +for i in total: + a = a+int(i) +print('您一共消费'+str(a)+'元') \ No newline at end of file -- libgit2 0.25.0