# 02.04 - NumPy Exercises¶

Exercises rating:

★☆☆ - You should be able to do it based on Python knowledge plus the text.

★★☆ - You will need to do extra thinking and some extra reading/searching.

★★★ - The answer is difficult to find by a simple search, requires you to do a considerable amount of extra work by yourself (feel free to ignore these exercises if you're short on time).

In [ ]:

In [ ]:

In [ ]:

In [ ]:

In [ ]:

In [ ]:

#### 7. Sort the columns of the following array (★☆☆)¶

In [ ]:
x = np.array([[3, 7],
[7, 3],
[1, 2]])

#### 8. Select the 3rd, 4th and 7th column of the following array (★★☆)¶

In [ ]:
x = np.arange(32).reshape(4, 8)

#### 9. Use argsort to sort the following array (★★☆)¶

In [ ]:
x = np.array([2, 7, 42, 27, 6, 9, 12])

#### 10. Retrieve all positive values smaller than 7 (★★☆)¶

In [ ]:
x = np.arange(-6, 58, 2).reshape(4, 8)

#### 11. In a single operation add 2 to all odd columns and 7 to all even columns (★★☆)¶

In [ ]:
x = np.arange(32).reshape(4, 8)