Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
allendowney
GitHub Repository: allendowney/thinkbayes2
Path: blob/master/scripts/cookie.py
1901 views
1
"""This file contains code for use with "Think Bayes",
2
by Allen B. Downey, available from greenteapress.com
3
4
Copyright 2012 Allen B. Downey
5
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
6
"""
7
8
from __future__ import print_function, division
9
10
from thinkbayes2 import Pmf
11
12
pmf = Pmf()
13
pmf.Set('Bowl 1', 0.5)
14
pmf.Set('Bowl 2', 0.5)
15
16
pmf.Mult('Bowl 1', 0.75)
17
pmf.Mult('Bowl 2', 0.5)
18
19
pmf.Normalize()
20
21
print(pmf.Prob('Bowl 1'))
22
23