probas.py

Created by alain-busser

Created on May 27, 2019

173 Bytes

Calcul d’un évènement puis de sa probabilité. L’univers doit être une variable globale. Par exemple pour un dé à 6 faces, U=set(range(1,7)). On note E.intersection(F) l’intersection de E et F, et E.union(F) leur réunion. Le contraire de l’évènement E s’obtient par U.difference(E) où U est l’univers.


def proba_conditionnelle(A,B):
  return len(A.intersection(B))/len(B)

def proba(E):
  global U
  return proba_conditionnelle(E,U)

def P(E):
  return proba(E)

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.