diff --git a/__pycache__/func.cpython-37.pyc b/__pycache__/func.cpython-37.pyc new file mode 100644 index 0000000..2428e8a Binary files /dev/null and b/__pycache__/func.cpython-37.pyc differ diff --git a/func.py b/func.py new file mode 100644 index 0000000..bfacc9a --- /dev/null +++ b/func.py @@ -0,0 +1,25 @@ +def n(): + a=[] + while True: + b=input() + if b=="q": + break + else: + try: + b=int(b) + except: + print("请输入数字") + else: + a.append(b) + return a +def sum(j): + count=0 + for i in j: + count=count+i + return count +#l=n() +#o=sum(l) +#print(o) + + + \ No newline at end of file diff --git a/s.py b/s.py new file mode 100644 index 0000000..23f2659 --- /dev/null +++ b/s.py @@ -0,0 +1,4 @@ +import func +data=func.n() +fc=func.sum(data) +print(fc) \ No newline at end of file