I wrote a code for Question 8(Matrix creation) of W3D2 coding assignment. Before reaching to the correct efficient code. I wrote some trial codes.

The Question is to create nested list: A = [[1,2,3],[4,5,6],[7,8,9]]

I wrote a preliminary code:

First Code:

```
outer_list=[[0,0,0],[0,0,0],[0,0,0]]
inner_list=[0,0,0]
for i in range(len(outer_list)):
print(f"i= {i}")
for j in range(len(inner_list)):
print(f"j={j}")
outer_list[i][j]=int(input())
print(outer_list)
```

This code gives me the correct result. It works

Second Trial:

I tried to use this code to define function that takes input from user for matrix dimension and matrix elements:

```
def initialise_matrix_2(inner,outer):
outer_list=[]
inner_list=[]
for a in range(inner):
inner_list.append(0)
print(f"inner_list= {inner_list}")
for b in range(outer):
outer_list.append(inner_list)
print(f"outer_list= {outer_list}")
for i in range(len(outer_list)):
#print(f"i={i}")
for j in range(len(inner_list)):
#print(f"j={j}")
#print(len(outer_list))
#print(outer_list[i][j])
outer_list[i][j]=int(input())
return outer_list
print(initialise_matrix_2(3,3))
```

I do not know why this code is not giving correct results, though I have tried more and written better code. But not sure why this code is not giving correct results.