Commit 86467fcb by BellCodeEditor

auto save

parent 4bed2ad7
...@@ -8,6 +8,7 @@ while True: ...@@ -8,6 +8,7 @@ while True:
else: else:
unit=int(unit) unit=int(unit)
total.append(unit) total.append(unit)
print(total)
return total #返回total return total #返回total
......
import import 返回
import import 返回
a=.new_input() a=返回.diancan()
b=.sum() b=返回.sum()
\ No newline at end of file
def diancan():
def diancan():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
try:
unit = int(unit)
except:
print("请重新输入一个数字")
else:
total.append(unit)
return total
def sum(money):
count = 0
for i in money:
count = count + i
return count
zhangdan=diancan() #zhangdan是我们的列表
zonghe=sum(zhangdan)
print(zonghe)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment