def posterior(prior, like): post = prior * like # compute the product of the probabilities return post / sum(post) # normalize the distribution