标签:list int else loop for lis oop 数字 lse
#数字列表中 连续最大的和
maxAddNum =0
loop = 0
testList = [-1,2,3,-4,5,-6,7,8,9,-10]
for i in testList:
loop = loop+i
if loop>=0:
maxAddNum = max(maxAddNum, loop)
else:
loop=0
print(maxAddNum)
标签:list int else loop for lis oop 数字 lse
原文地址:https://www.cnblogs.com/caozijian-zm/p/10304527.html