In: Computer Science
Create and Compile a Python Script without using Numpy that
CODE :
OUTPUT :
Raw_Code :
import random
n = int(input("Enter n : "))
#taking n and Q as input
Q = int(input("Enter Q : "))
matrix = []
row = random.randint(0,n-1) #generating random row
and column
column = random.randint(0,n-1)
for i in range(n):
dup = []
for j in range(n):
#creating matrix with zeros
dup.append(0)
matrix.append(dup)
matrix[row][column] = Q #assign Q to known row and column
print("The Matrix is : ")
for i in range(n):
#printing matrix
for j in range(n):
print(matrix[i][j],end=' ')
print()
***********Comment me for any Queries and Rate me up************