Skip to content

Instantly share code, notes, and snippets.

@goindwalia
Last active September 29, 2015 10:24
Show Gist options
  • Save goindwalia/42a5e3ede1192d48f41e to your computer and use it in GitHub Desktop.
Save goindwalia/42a5e3ede1192d48f41e to your computer and use it in GitHub Desktop.
import numpy
# getting values from user for no. of rows and columns
n = int(raw_input("Enter no. of rows: "))
m = int(raw_input("Enter no. of columns: "))
#generating matrix with the help of numpy
matrix = numpy.zeros(shape=(n,m))
for rows in range(0,n):
x = float(raw_input("Enter the value of x for row %s: " % int(rows+1)))
matrix[rows] = [x ** n for n in range(0, m)]
print matrix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment