Categories
By Aman Kharwal

Mathematical Operations Between Lists

Addition, subtraction, multiplication and division between lists in python.

Addition of two lists

list1 = [1, 2, 3, 4]
list2 = [4, 3, 2, 1]
for i in list2:
    for j in list1:
        print(i,"+",j,"=",i+j)
#Output

Subtraction of two lists

list1 = [1, 2, 3, 4]
list2 = [4, 3, 2, 1]
for i in list2:
    for j in list1:
        print(i,"-",j,"=",i-j)

#Output

Division of two lists

list1 = [1, 2, 3, 4]
list2 = [4, 3, 2, 1]
for i in list2:
    for j in list1:
        print(i,"/",j,"=",i/j)

#Output

Multiplication of two lists

list1 = [1, 2, 3, 4]
list2 = [4, 3, 2, 1]
for i in list2:
    for j in list1:
        print(i,"x",j,"=",i*j)

#Output

Leave a Reply