From f1dc6a1db2fcd7b1034e1a0e133b975fca5d30f8 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sat, 9 Apr 2022 18:49:57 +0800 Subject: [PATCH] save project --- __pycache__/myf.cpython-37.pyc | Bin 0 -> 495 bytes myf.py | 21 +++++++++++++++++++++ test0409.py | 3 +++ 3 files changed, 24 insertions(+) create mode 100644 __pycache__/myf.cpython-37.pyc create mode 100644 myf.py create mode 100644 test0409.py diff --git a/__pycache__/myf.cpython-37.pyc b/__pycache__/myf.cpython-37.pyc new file mode 100644 index 0000000..36cdcca Binary files /dev/null and b/__pycache__/myf.cpython-37.pyc differ diff --git a/myf.py b/myf.py new file mode 100644 index 0000000..7ed4614 --- /dev/null +++ b/myf.py @@ -0,0 +1,21 @@ +def new_input(): + listA=[] + while True: + a=input() + b=0 + if a=='q': + break + else: + try: + b=int(a) + except: + pass + else: + listA.append(b) + return listA + +def sum(li): + s=0 + for i in li: + s+=i + return s \ No newline at end of file diff --git a/test0409.py b/test0409.py new file mode 100644 index 0000000..7d6d463 --- /dev/null +++ b/test0409.py @@ -0,0 +1,3 @@ +import myf +s=myf.new_input() +print( myf.sum(s) ) \ No newline at end of file -- libgit2 0.25.0