Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save maxkarelov/dcf2d689b046b2d68dc1a140559e7e52 to your computer and use it in GitHub Desktop.
Save maxkarelov/dcf2d689b046b2d68dc1a140559e7e52 to your computer and use it in GitHub Desktop.
AI task 4
def com(A, B):
result = [[[] for j in range(0, 4)] for i in range(0, 4)]
for i in range(0, 4):
T = []
for j in range(0, 4):
for k in range(0, 4):
result[i][j].append(min(A[i][k], B[k][j]))
return result
if __name__ == '__main__':
A = [[0.9, 0.2, 0.6, 0.4],
[0.2, 0.6, 0.3, 0.4],
[0.2, 0.4, 0.6, 0.3],
[0.3, 0.9, 0.6, 0.1]]
B = [[0.6, 0.2, 0.4, 0.3],
[0.3, 0.6, 0.6, 0.4],
[0.9, 0.2, 0.1, 0.2],
[0.6, 0.6, 0.4, 0.2]]
raw = com(A, B)
print [[max(raw[i][j]) for j in range(0, 4)] for i in range(0, 4)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment