Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

programe to find contagious sum of sequence

n = [2,-3,-4,4,-5,6]

sum_list = []

for i in range(len(n)):
    for j in range(len(n)):
        if j<i:
            continue
        else:
            x = sum(n[i:j+1])
            sum_list.append(x)
print(max(sum_list))
Comment

PREVIOUS NEXT
Code Example
Python :: pandas row printed horizontally 
Python :: how to make a square shape in python 
Python :: Python Key Gen 
Python :: code=H18 desc="Server Request Interrupted" django 
Python :: violin plot seaborn 
Python :: handle dict invalid key python 
Python :: anagram game 
Python :: python wait for executable to finish before perceeding 
Python :: flask Upload file to local s3 
Python :: plt clor image histogram 
Python :: how to use google translate api in python 
Python :: write to file python 
Python :: wx.SingleInstanceCheckerindexmodules 
Python :: platform.system() return value 
Python :: num = [7,8, 120, 25, 44, 20, 27] newnum = [] def remove_even(num): for i in num: if i%2 != 0: newnum.append(i) return newnum print("get_unevens") test(remove_even(num), [7,25,27]) 
Python :: python getattr function 
Python :: color to black and white opencv 
Python :: python types generator 
Python :: Reason: "broken data stream when reading image file" in jupyter notebook 
Python :: pandas return indices that match 
Python :: divide all the numbers of a list by one number python 
Python :: Arduino - Send Commands with Serial Communication with python 
Python :: install wget in anaconda 
Python :: golng open file append 
Python :: multiplication table for number python codewars 
Python :: upper python 
Python :: inverting a dictionary 
Python :: python file io 
Python :: dataframe 
Python :: mysql_python 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =