Answers for "how to add 2 to all numbers in a list python"

1

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]
Posted by: Guest on December-20-2020
8

find sum of 2 numbers in array using python

a = int(input("Enter first number:"))
b = int(input("Enter second number:"))
sum = a+b
print(sum)
Posted by: Guest on March-06-2020

Code answers related to "how to add 2 to all numbers in a list python"

Python Answers by Framework

Browse Popular Code Answers by Language