Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. import random
  2. def game(ra, rb):
  3. prob_a = ra / (ra + rb)
  4.  
  5. points_a = 0
  6. points_b = 0
  7.  
  8. winning_score = 11
  9.  
  10. while points_a < winning_score and points_b < winning_score:
  11. prob = random.random()
  12. if prob < prob_a:
  13. points_a += 1
  14. else:
  15. points_b += 1
  16. return(points_a, points_b)
  17.  
  18. game(70,30)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement