Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python average of two lists by row

# Basic syntax:
[(a + b)/2 for a, b in zip(list_1, list_2)]

# Example usage:
list_1 = [1, 2, 3]
list_2 = [4, 5, 6]
[(a + b)/2 for a, b in zip(list_1, list_2)]
--> [2.5, 3.5, 4.5]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #average #lists #row
ADD COMMENT
Topic
Name
3+9 =