# NumPy: Advanced Exercises, Practice, Solution

## Advanced NumPy Exercises [ 15 exercises with solution]

[An editor is available at the bottom of the page to write and execute the scripts. Go to the editor]

1. Write a NumPy program to find the dot product of two arrays of different dimensions.
Click me to see the sample solution

2. Write a NumPy program to create a 3x3 identity matrix and stack it vertically and horizontally.
Click me to see the sample solution

3. Write a NumPy program to create a 4x4 array with random values and find the sum of each row.
Click me to see the sample solution

4. Write a NumPy program to create a 3x3 array with random values and subtract the mean of each row from each element.
Click me to see the sample solution

5. Write a NumPy program to create a 3x3 array with random values and subtract the mean of each column from each element.
Click me to see the sample solution

6. Write a NumPy program to create a 5x5 array with random values and normalize it row-wise.
Click me to see the sample solution

7. Write a NumPy program to create a 5x5 array with random values and normalize it column-wise.
Click me to see the sample solution

8. Write a NumPy program to create a 3x3x3 array with random values and find the sum along the last axis.
Click me to see the sample solution

9. Write a NumPy program to create a 5x5 array with random values and sort each row.
Click me to see the sample solution

10. Write a NumPy program to create a 5x5 array with random values and sort each column.
Click me to see the sample solution

11. Write a NumPy program to create a 5x5 array with random values and find the second-largest value in each row.
Click me to see the sample solution

12. Write a NumPy program to create a 5x5 array with random values and find the second-largest value in each column.
Click me to see the sample solution

13. Write a NumPy program to create a 5x5 array with random values and replace the maximum value with 0.
Click me to see the sample solution

14. Write a NumPy program to create a 5x5 array with random values and replace the minimum value with 0.
Click me to see the sample solution

15. Write a NumPy program to create a 5x5 array with random values and calculate the exponential of each element.
Click me to see the sample solution

Python-Numpy Code Editor:

More to Come !

Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.

Test your Python skills with w3resource's quiz

﻿

## Python: Tips of the Day

Decapitalizes the first letter of a string:

Example:

```def tips_decapitalize(s, upper_rest=False):
return s[:1].lower() + (s[1:].upper() if upper_rest else s[1:])
print(tips_decapitalize('PythonTips'))
print(tips_decapitalize('PythonTips', True))
```

Output:

```pythonTips
pYTHONTIPS
```

We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook