Advanced and scientific Python

Logo

Materials to brush up your Python skills

View the Project on GitHub xoolive/pyclass

Numpy and Matplotlib

This session is based on a Python file. When you open this file with Visual Studio Code, you will notice pseudo-cells prefixed as follows:

vscode ipython

Clicking on Run Cell (or pressing Maj+Enter) runs an IPython kernel appearing (usually) on the right side of your screen.

This approach is comfortable to preliminary projects:

Good practice    Consider this option before jumping to Jupyter notebooks when you start a new project. Notebooks are a natural choice for education materials, but they lack rigor in terms of software engineering and management.

The file is located in the python/ folder:

More exercices for NumPy

This is a selection of exercises from https://github.com/rougier/numpy-100

  1. Reverse a vector. You may use vector x defined as follows:

    x = np.arange(50)
    
  2. Find the min and max values in a 10x10 array. Find their indices.

    x = np.random.random((10, 10))
    
  3. Create a 2d array with 1 on the border and 0 inside.

  4. Create a 5x5 matrix with values 1,2,3,4 just below the diagonal

  5. Create a 8x8 matrix and fill it with a checkerboard pattern

  6. Normalize a 5x5 random matrix

    x = np.random.random((5, 5))
    

More exercices for Matplotlib

↑ Home | Next »