Advertisement
karlakmkj

Variance of the Binomial Distribution

Jul 27th, 2021
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. '''
  2. Calculate variance using the formula: n×p×(1−p), where
  3.     n = no. of events
  4.    p = probability of the event occurring
  5.    (1-p) = probability that it does not happen
  6. '''
  7.  
  8. # Find variance for a certain basketball player that has an 85% chance of making a given free throw, for 20 shots.
  9. variance_baskets = 20 * 0.85 * 0.15
  10. print(variance_baskets)
  11.  
  12. # Find variance for student that has a 98% chance of arriving on time to class, in throughout the 180 school days in a school year.
  13. variance_late = 180 * 0.02 * 0.98
  14. print(variance_late)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement