Source: https://perso.limsi.fr/pointal/_media/python:cours:tpinfopython_2011-2012-s2-tp3.pdf