Advertisement
z_californianus

Untitled

Apr 9th, 2020
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. rom matplotlib import pyplot as plt
  2. from math import factorial
  3.  
  4. p = .2  # add your code here: what is the probability of drawing up a contract?
  5. n = 30  # add your code here: how many companies will we negotiate with?
  6.  
  7. distr = []  # add your code here: create a variable for the distribution value
  8.  
  9. for k in range(0, n+1):
  10.     c = factorial(n)/(factorial(k) * factorial(n-k))
  11.     prob = c * p**k * (1-p)**(n-k)
  12.     distr.append(prob)
  13. plt.bar(
  14.     range(0, n+1),
  15.     distr
  16. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement