Cancer

P(c)= p0 = 0.1, p(¬c)=0.9
p(pos|c)= p1 = 0.9, p(pos|¬c)=0.1
p(neg|¬c)= p2 = 0.8, p(neg|c)= 0.2

p(p)= 0.09 + 0.18 = 0.27

def f(p0, p1, p2):
	return p0*p1 + (1-p0)*(1-p2)
print f(0.1, 0.9, 0.8)

program bayes rule

def f(p0, p1, p2):
	return p0*p1 / (p0 * p1 + (1-p0)*(1-p2))
print f(0.1, 0.9, 0.8)
def f(p0,p1,p2):
	return p0 * (1-p1)/(p0 * (1-p1)+(1-p0)*p2)
print f(0.1, 0.9, 0.8)