from random import * from math import * import matplotlib.pyplot as plt ###################################### # Ecriture d'un algorithme en Python modélisant le problème ###################################### def collection() : ALBUM = [] FREQ = [] for compteur in range(480) : ALBUM.append(0) while min(ALBUM) == 0 : ALBUM[randint(0, 479)] += 1 for compteur in range(480) : FREQ.append(ALBUM[compteur] / sum(ALBUM)) p = 1 / 480 freq_mini = p - 1.96 * sqrt(p * (1 - p) / sum(ALBUM)) freq_maxi = p + 1.96 * sqrt(p * (1 - p) / sum(ALBUM)) return max(ALBUM), sum(ALBUM), freq_mini, freq_maxi, FREQ