FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
hackerrank-python/numpy-python/dot-cross.py at master · anishLearnsToCode/hackerrank-python · GitHub
anishLearnsToCode
/
hackerrank-python
Public
Notifications
You must be signed in to change notification settings
Fork
3
Star
13
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
hackerrank-python
/
numpy-python
/
dot-cross.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (19 loc) · 608 Bytes
Breadcrumbs
hackerrank-python
/
numpy-python
/
dot-cross.py
Copy path
File metadata and controls
28 lines (19 loc) · 608 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# https://www.hackerrank.com/challenges/np-dot-and-cross/problem
import
numpy
numpy
.
set_printoptions
(
legacy
=
'1.13'
)
def
zero
(
size
):
return
[
0
for
_
in
range
(
size
)]
def
get_matrix
(
size
):
matrix
=
[]
for
_
in
range
(
size
):
matrix
.
append
(
list
(
map
(
int
,
input
().
split
())))
return
matrix
N
=
int
(
input
())
matrix1
=
numpy
.
array
(
get_matrix
(
N
))
matrix2
=
numpy
.
array
(
get_matrix
(
N
)).
transpose
()
result
=
[]
for
row
in
range
(
N
):
result
.
append
(
zero
(
N
))
for
column
in
range
(
N
):
result
[
row
][
column
]
=
int
(
numpy
.
dot
(
matrix1
[
row
],
matrix2
[
column
]))
print
(
numpy
.
array
(
result
))
Back
|
FazBrowse Home
|
New Git URL