jeudi 7 juin 2018

Why doesn't my code work? Please help me Debug! PYTHON

I'm trying to create a program where I enter a dimension of a matrix -- for example if I enter 3, it'll make a 3 x 3 matrix. However, when I try to compile on an online python compiler the error message: " Module 'numpy.random' has no 'randint' member " pops up. When I enter to an actual compiler it says syntax error near Line 3. PLEASE HELP!!

import numpy as np

print ("Please enter the dimension of Matrix: ")

N = int(input())

matrix = np.random.randint(11, size = (N,N))

matrix2  = np.random.randint(11, size = (N,N))

print (matrix)
print (matrix2)




Aucun commentaire:

Enregistrer un commentaire