title: How to take matrix input from the user and display the matrix in Python?
body: <p>I have an experience in java and c++ for 7 years now. I recently started learning python. Can someone please help me on how to read the input for the matrix and display the same in matrix format. This is the code I wrote:</p>
  
  <pre><code>import sys
  
  # no of rows are equal to the number of columns.
  n = int(input("Enter the number of rows in a matrix"))
  a = [[0 for x in range (n)] for y in range(n)]
  for i in range (n):
      for j in range(n):
          a[i][j]=int(input())
          print (a[i][j])
      print("\n")
  </code></pre>