Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- names = ['A', 'B', 'C', 'D']
- P = [0.9, 0.5, 0.2, 0]
- ERROR = 0.05
- def plus(x):
- return P[x] * (1 - ERROR)
- def minus(x):
- return 1 - plus(x)
- two_negatives = sum(map(lambda i: minus(i) ** 2, range(4)))
- C = list(map(lambda i: two_negatives - minus(i) ** 2, range(4)))
- total = sum(map(lambda i: C[i] * plus(i), range(4)))
- res = list(map(lambda i: C[i] * plus(i) / total, range(4)))
- for ind in range(4):
- print("The answer for {} is {}".format(names[ind], res[ind]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement