Learn data science and machine learning by building real-world projects on Jovian

Sign up to execute **100-numpy-exercises** and 150,000+ data science projects. Build your own projects and share them online!

Updated 8 months ago

The recommended way to run this notebook is to click the "Run" button at the top of this page, and select "Run on Binder". This will run the notebook on mybinder.org, a free online service for running Jupyter notebooks.

If you are stuck, you can ask for help on the community forum: https://jovian.ml/forum/t/100-numpy-exercises-hints-discussions-help/10561 . You can get help with errors, ask for hints, and share your solutions with others.

If you're new to Numpy, check out this notebook for a quick tutorial: https://jovian.ml/aakashns/python-numerical-computing-with-numpy

Remember to save a snapshot of your work from time to time using to your Jovian.ml account.

In [24]:

`!pip install jovian --upgrade --quiet`

In [25]:

`import jovian`

In [28]:

`jovian.commit(project='100-numpy-exercises')`

```
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/100-numpy-exercises" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/100-numpy-exercises
```

`jovian.commit`

uploads the notebook to your Jovian.ml account, captures the Python environment and creates a shareable link for your notebook as shown above. You can use this link to share your work and let anyone (including you) run your notebooks and reproduce your work. Learn more: https://jovian.ml/docs/

In [ ]:

```
# Ucomment the next line if you need install numpy
# !pip install numpy --upgrade
```

`np`

(★☆☆)In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

Save your progress by commiting your work to Jovian

In [4]:

`import jovian`

In [27]:

`jovian.commit(project='numpy-100-exercises')`

```
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/numpy-100-exercises" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/numpy-100-exercises
```

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

```
0 * np.nan
np.nan == np.nan
np.inf > np.nan
np.nan - np.nan
np.nan in set([np.nan])
0.3 == 3 * 0.1
```

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

Save your progress by commiting your work to Jovian

In [7]:

`import jovian`

In [6]:

`jovian.commit()`

```
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/numpy-100-exercises" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/numpy-100-exercises
```

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

```
# Author: Jake VanderPlas
print(sum(range(5),-1))
from numpy import *
print(sum(range(5),-1))
```

In [ ]:

` `

```
Z**Z
2 << Z >> 2
Z <- Z
1j*Z
Z/1/1
Z<Z>Z
```

In [ ]:

` `

```
np.array(0) / np.array(0)
np.array(0) // np.array(0)
np.array([np.nan]).astype(int).astype(float)
```

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

Save your progress by commiting your work to Jovian

In [8]:

`import jovian`

In [9]:

`jovian.commit()`

```
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/numpy-100-exercises" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/numpy-100-exercises
```

In [ ]:

` `

```
np.sqrt(-1) == np.emath.sqrt(-1)
```

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

Save your progress by commiting your work to Jovian

In [10]:

`import jovian`

In [11]:

`jovian.commit()`

```
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/numpy-100-exercises" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/numpy-100-exercises
```

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

`x`

and `y`

coordinates covering the [0,1]x[0,1] area (★★☆)In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

Save and commit your work.

In [12]:

`import jovian`

In [13]:

`jovian.commit()`

```
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/numpy-100-exercises" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/numpy-100-exercises
```

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

```
1, 2, 3, 4, 5
6, , , 7, 8
, , 9,10,11
```

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

Save and commit your work.

In [14]:

`import jovian`

In [15]:

`jovian.commit()`

```
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/numpy-100-exercises" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/numpy-100-exercises
```

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

Save and commit your work

In [16]:

`import jovian`

In [17]:

`jovian.commit()`

```
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/numpy-100-exercises" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/numpy-100-exercises
```

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

`fill`

value when necessary) (★★★)In [ ]:

` `

Save and commit your work.

In [18]:

`import jovian`

In [19]:

`jovian.commit()`

```
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/numpy-100-exercises" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/numpy-100-exercises
```

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

Save and commit your work

In [20]:

`import jovian`

In [21]:

`jovian.commit()`

```
[jovian] Attempting to save notebook..
[jovian] Updating notebook "aakashns/numpy-100-exercises" on https://jovian.ml/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ml/aakashns/numpy-100-exercises
```

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

In [ ]:

` `

Save and commit your work

In [22]:

`import jovian`

In [ ]:

`jovian.commit()`

```
[jovian] Attempting to save notebook..
```

Congratulations on completing the 100 exercises, well done!

- Share your completed notebook on Facebook, LinkedIn or Twitter and challenge your friends.
- Share your solutions and help others on the forum: https://jovian.ml/forum/t/100-numpy-exercises-hints-discussions-help/10561
- Check out our course on "Data Analysis with Python: Zero to Pandas" - https://jovian.ml/learn/data-analysis-with-python-zero-to-pandas
- Star this repository to show your appreciation for the original author of this notebook: https://github.com/rougier/numpy-100