Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

accumulate sum of elements in list

# accumulate sum of elements in list
import itertools					# import python module itertools
st1 = [ 1, 2, 3, 4, 5 ]
sum_list = itertools.accumulate(st1)			# accumulate sum of elements
print(list(sum_list))					# [ 1, 3, 6, 10, 15 ]
Comment

PREVIOUS NEXT
Code Example
Python :: "2 + 2" operación en string python 
Python :: bson to dataframe pandas 
Python :: !r in python fstring 
Python :: metasploit in python 
Python :: how does gas exchange happen in the alveoli 
Python :: time vs timeit 
Python :: filter all columns in pandas 
Python :: How to avoit print() to go to newline each time 
Python :: r is.na pandas 
Python :: for i in range(1, 11): print(i, end="") 
Python :: get weather data from weather underground 
Python :: Data Analytics with Pandas – How to Drop a List of Rows from a Pandas Dataframe 
Python :: give the factorials of 6 in python 
Python :: python is not defined 
Python :: html in nested structure 
Python :: Flatten List in Python Using Without Recursion 
Python :: how to get class names in predict_proba 
Python :: unique character 03 set and length comparison 
Python :: codeforces 1133A in python 
Python :: velocity field gradient 
Python :: run flask in Jython 
Python :: comments 
Python :: intervalle de temps python 
Python :: sensitivity 
Python :: Python NumPy dstack Function Syntax 
Python :: emit data to specific client socketio python 
Python :: Python how to use __ge__ 
Python :: print number upto 2 decimal places in f string python 
Python :: django view - APIView (urls.py config) 
Python :: python mysqldb sockets 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =