# Dot and Cross in Python HackerRank Solution

#### ByBrokenprogrammers

Dec 10, 2022

Hello Programmers, In this post, you will know how to solve the Dot and Cross in Python HackerRank Solution. This problem is a part of the HackerRank Python Programming Series.

One more thing to add, donâ€™t directly look for the solutions, first try to solve the problems of Hackerrank by yourself. If you find any difficulty after trying several times, then you can look for solutions.

## Dot and Cross in Python HackerRank Solutions

### Problem

dotThe dot tool returns the dot product of two arrays.

```import numpy
A = numpy.array([ 1, 2 ])
B = numpy.array([ 3, 4 ])
print numpy.dot(A, B)       #Output : 11
```

CrossThe cross tool returns the cross product of two arrays.

```import numpy
A = numpy.array([ 1, 2 ])
B = numpy.array([ 3, 4 ])
print numpy.cross(A, B)     #Output : -2
```

You are given two arrays A and B. Both have dimensions of NXN.

#### Input Format :

The first line contains the integer N.
The next N lines contains N space separated integers of array A.The following N lines contains N space separated integers of array B.

#### Output Format :

Print the matrix multiplication of A and B.

```2
1 2
3 4
1 2
3 4
```

#### Sample Output :

```[[ 7 10]
[15 22]]```

### Dot and Cross in Python HackerRank Solutions

```import numpy
n = int(input())
a = numpy.array([input().split() for _ in range(n)], int)
b = numpy.array([input().split() for _ in range(n)], int)
print(numpy.dot(a, b))```

Disclaimer: The above Problem (Dot and Cross in Python) is generated by Hackerrank but the Solution is Provided by BrokenProgrammers. This tutorial is only for Educational and Learning purposes.