1

I want to print array rows but with this code I just print last row. How can I print all rows?

pq = [[0]*3] * 8
count = 5
M_ids = [3,5,7]
for i in M_ids:
    print(i)
    random_q = randrange(0, count)
    random_p = count - random_q
    pq[i][0] = i
    pq[i][1] = random_p
    pq[i][2] = random_q
    print('M', pq[i][0], ':', 'p=', pq[i][1], '| q=', pq[i][2])
print(pq)
wjandrea
  • 23,210
  • 7
  • 49
  • 68

0 Answers0