Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python subtract between list

# Subtract two lists with zip()
list1 = [10, 11, 12]
list2 = [1, 2, 3]
subtracted = [element1 - element2 for (element1, element2) in zip(list1, list2)]
print(subtracted)
# Returns: [9, 9, 9]
 
PREVIOUS NEXT
Tagged: #python #subtract #list
ADD COMMENT
Topic
Name
8+1 =