Python program to Generate Matrix of Random Numbers

from random import randint
row = 6
col = 6
x = []
for i in range(row):
 y = []
 for j in range(col):
    y.append(randint(1,100))
 x.append(y)
for i in x:
 for j in i:
    print("%3d" % j, end=' ')
 print()

 

 

 

Output:

 17  75  27  97  53  41
 85  52  54  50  11  31
  2  68  21  91 100  16
 12  48  33  99  25  73
 74  32  41  81  42  59
 60  96  32  33  88  44

 

Subscribe For Daily Updates

100+ Python Pattern Examplespython pattern examples - star patterns, number patterns