# Input numbers in nested list and check sum of each row is same or not in Python

###### Lists - Question 13

In this question, we will see how to input numbers in a 3X3 integer matrix (nested list) and check whether the sum of each row is same or not in Python programming. To know more about lists click on the lists lesson.

**Q13)** Write a program in Python to input numbers in a 3X3 integer matrix (nested list) and check whether the sum of each row is same or not.

#### Program

```
a=[[],[],[]]
r=0;c=0;rs=0;frs=0;x=0
print('Enter 9 numbers')
for r in range(3):
for c in range(3):
a[r].append(int(input()))
for r in range(3):
rs=0
for c in range(3):
print(a[r][c],end=' ')
rs=rs+a[r][c]
print(' Row Sum =',rs)
if r==0:
frs=rs # store the first row sum in frs variable
elif frs!=rs:
x=1
if x==0:
print('Sum of each row is same')
else:
print('Sum of each row is not same')
```

#### Output

Enter 9 numbers 5 5 5 5 5 5 5 5 5 5 5 5 Row sum = 15 5 5 5 Row sum = 15 5 5 5 Row sum = 15 Sum of each row is same