Sunday, March 3, 2019

Addition of Matrix - Python3

a=[]
b=[]
c=[]
n=int(input("Enter the size of lists:"))
print("Enter elements in list a:")
for i in range(n) :
    x=int(input("Enter the value: "))
    a.append(x);
print(a)
print("Enter elements in list b:")
for i in range(n) :
    y=int(input("Enter the value: "))
    b.append(y);
print(b)
print("Addition of above two lists:")
for i in range(len(a)) :
    sum1=a[i]+b[i]
    c.append(sum1)
print(c)

ScreenShot:


No comments:

Post a Comment