![](/img/trans.png)
[英]Create a dict whose value is the set of all possible anagrams for a given word
[英]create matrix whose position value is given by a function
我必须从下面给出的 function 创建一个 5X5 矩阵。
f(x,y) = x(1-y) + y(1-x); 其中 0 < x,y <=5
其中 x 表示行 position 并且 y 表示列。 如何创建一个矩阵,使左下角为 f(0,0),左上角的值为 f(5,5)
M,N = 5,5
matrix = [[((x*(1-y))+(y*(1-x))) for y in range(M)] for x in range(N)]
for i in range(N):
print(matrix[i])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.