dimanche 10 juillet 2016

Python random matrix

How to solve the problem to create a matrix with random numbers (user input)? I also how a problem with this: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 23: ordinal not in range(128)

Thank you in advance!

array = list()
i = int(input("How many row: "))      
j = int(input("How many column: "))    


for x in range(i):                
    if i <= 0 or i>10:
        print("Failure!")  
        break
    elif j <= 0 or j>10:
        print("Failure!")
        break
    else:
        for y in range(j):        
            num = raw_input("Value: ")       
            array.append(int(num))


a = np.reshape((i,j))
print a




Aucun commentaire:

Enregistrer un commentaire