numworks_pas_numworks.py

Created by elodie-gamot

Created on September 29, 2021

321 Bytes

Un fabricant de calculatrice (qui n’est pas NumWorks!) constate que 2% de ses produits présentent un défaut. On note X le nombre de calculatrices défectueuses dans un carton de 200 produits. Un professeur de mathématiques un peu curieux décide de vérifier cette affirmation et constate avec horreur que 7 calculatrices sont défectueuses dans le carton qu’a reçu son lycée. Cette constatation est-elle étonnante ?


from random import *
from matplotlib.pyplot import *

def defect_carton():
  defect=0
  for i in range(200):
    if random()<=0.02:
      defect+=1
  return defect

def echantillon(N):
  x=[i for i in range(N)]
  y=[]
  for k in range(N):
    y.append(defect_carton())
  scatter(x,y)
  show()

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.