Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

calculate the addition of two lists in python

list1 = [1, 2, 3]
list2 = [4, 5, 6]

# `zipped_lists` contains pairs of items from both lists.
# Create a list with the sum of each pair.
sum = [x + y for (x, y) in zip(list1, list2)] 

print(sum)
# [5, 7, 9]
Comment

python how to sum two lists

import numpy as np
np.add(first, second)
Comment

PREVIOUS NEXT
Code Example
Python :: pandas write csv 
Python :: replace multiple column values pandas 
Python :: how to revert a list python 
Python :: dataframe check for nan in iterrows 
Python :: pandas add prefix zeros to column values 
Python :: matplotlib draw line x1, y1 
Python :: create a virtual environment in python3 
Python :: how to pick everything after a character in python 
Python :: restrict ticks to integers matplotlib 
Python :: how to get pytroch model layer name 
Python :: python undefined 
Python :: python matrix 
Python :: len in python 
Python :: install turtle python mac 
Python :: pandas apply 
Python :: why a Python Arithmetic Operators used 
Python :: gridsearch cv 
Python :: df groupby 
Python :: IQR to remove outlier 
Python :: iterate over a set python 
Python :: torch root mean square 
Python :: flat numpy array 
Python :: scrapy selenium screnshot 
Python :: compare multiple columns in pandas 
Python :: django template render dict 
Python :: file open in python 
Python :: python delete key dictionary 
Python :: django abstractuser 
Python :: initialize np array 
Python :: run all python files in a directory in windows 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =