title: How to input matrix (2D list) in Python?
body: <p>I tried to create this code to input an m by n matrix. I intended to input <code>[[1,2,3],[4,5,6]]</code> but the code yields <code>[[4,5,6],[4,5,6]</code>. Same things happen when I input other m by n matrix, the code yields an m by n matrix whose rows are identical. </p>
  
  <p>Perhaps you can help me to find what is wrong with my code.</p>
  
  <pre><code>m = int(input('number of rows, m = '))
  n = int(input('number of columns, n = '))
  matrix = []; columns = []
  # initialize the number of rows
  for i in range(0,m):
    matrix += [0]
  # initialize the number of columns
  for j in range (0,n):
    columns += [0]
  # initialize the matrix
  for i in range (0,m):
    matrix[i] = columns
  for i in range (0,m):
    for j in range (0,n):
      print ('entry in row: ',i+1,' column: ',j+1)
      matrix[i][j] = int(input())
  print (matrix)
  </code></pre>