8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 81753d0 commit f664264Copy full SHA for f664264< 8000 /pre>
numpy-python/dot-cross.py
@@ -0,0 +1,28 @@
1
+# https://www.hackerrank.com/challenges/np-dot-and-cross/problem
2
+
3
+import numpy
4
+numpy.set_printoptions(legacy='1.13')
5
6
7
+def zero(size):
8
+ return [0 for _ in range(size)]
9
10
11
+def get_matrix(size):
12
+ matrix = []
13
+ for _ in range(size):
14
+ matrix.append(list(map(int, input().split())))
15
+ return matrix
16
17
18
+N = int(input())
19
+matrix1 = numpy.array(get_matrix(N))
20
+matrix2 = numpy.array(get_matrix(N)).transpose()
21
22
+result = []
23
+for row in range(N):
24
+ result.append(zero(N))
25
+ for column in range(N):
26
+ result[row][column] = int(numpy.dot(matrix1[row], matrix2[column]))
27
28
+print(numpy.array(result))
0 commit comments