Suppose I have two lists like this,
Ii = [[7,1],[7,5],[7,8],[5,8],[2,8],[3,5]]
ci = [11,5,3,5,5,4]
Now I want to make another list (I) of m x n which will look like this,
I =
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[11, 0, 0, 0, 5, 0, 0, 3, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 5, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 4, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 5, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
I tried this code,
m,n = 8,10
I = [[0 for j in range(n)] for i in range(m)]
for i, j in Ii:
I[m - i][j - 1] = 1
Which have an output looks like this,
I =
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[1, 0, 0, 0, 1, 0, 0, 1, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 1, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Now I have 1 where I wanted the values of ci. But I want to put the values of ci in the places of 1. Need help regarding how can I do this?
nand what ism?IformIiandci?