Source: http://pc.fermat.free.fr/Python/TP2-c.pdf