Exercises

This notebook aims to provide a list of exercises useful to start practising your programming skills


How to start

Opening a new notebook, you should start importing the modules that are needed for the notebook to work. For instance: import numpy, import matplotlib, import datacube, etc.

In the following cells there will be some exercise with an hidden solution so that you can try to solve the problem yourself. Click on the green button 'Show Solution' to compare your solution with the one provided.

Be aware: in programming there are multiple right solutions, so it is only important that you find the same results.

If statement:

To solve the exercises you need to be aware of the if statement and its use. You can find out more details in this link: https://www.w3schools.com/python/python_conditions.asp

Working with conditional statements and loops

1) Given the array a = np.arange(1000)

    i) Find the numbers that are divisible by 7 and save them in an array b
    ii) Print all the values from 0 to 10 and all the values from 80 to 90 in b

2) Write the Fibonacci series between 0 to 1000

The Fibonacci sequence is the series of numbers : 0, 1, 1, 2, 3, 5, 8, .... 
Every next number is found by adding up the two numbers before it.
Start with 0 and 1, for example a = [0,1] and then find the remaining numbers up to 1000