Source: https://perso.limsi.fr/pointal/_media/python:cours:tpinfopython_2016-2017_sp1-tp3.pdf