# Numpy - operations

<mark>import numpy as np</mark>

<mark>a = np.array([1, 2, 3])</mark>

<mark>b = np.array([5, 6, 7])</mark>

1) *Performs element-wise operations*

<mark>print(a + 2)</mark>

<mark>print(a *</mark> *<mark> 3)</mark>*

*<mark>print(a </mark>* <mark>** 2)</mark>

<mark>print(a / 2)</mark>

<mark>print(a % 2)</mark>

<mark>print(a + b)</mark>

```python
[3 4 5]
[3 6 9]
[1 4 9]
[0.5 1.  1.5]
[1 0 1]
[ 6  8 10]
```

Note: in case of (a + b) -&gt; both must be of the same dimensions or will throw an error

2) *Some common built-in functions*

<mark>print(a.mean())</mark>

<mark>print(b.sum())</mark>

/ Dot operation

<mark>a1_2d = np.array([[1, 2], [3, 4]])</mark>

<mark>a2_2d = np.array([[10, 20], [30, 40]])</mark>

<mark>a1_2d.dot(a2_2d)</mark>

```python

2.0
18
array([[ 70, 100],
       [150, 220]])
```

Note: there are a lot more other built-in functions but these two are the most used
