Advertisement
achulkov2

Untitled

Sep 28th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. names = ['A', 'B', 'C', 'D']
  2. P = [0.9, 0.5, 0.2, 0]
  3. ERROR = 0.05
  4.  
  5.  
  6. def plus(x):
  7.     return P[x] * (1 - ERROR)
  8.  
  9.  
  10. def minus(x):
  11.     return 1 - plus(x)
  12.  
  13.  
  14. two_negatives = sum(map(lambda i: minus(i) ** 2, range(4)))
  15. C = list(map(lambda i: two_negatives - minus(i) ** 2, range(4)))
  16. total = sum(map(lambda i: C[i] * plus(i), range(4)))
  17. res = list(map(lambda i: C[i] * plus(i) / total, range(4)))
  18. for ind in range(4):
  19.     print("The answer for {} is {}".format(names[ind], res[ind]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement