Advertisement
Guest User

Untitled

a guest
Sep 28th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.41 KB | None | 0 0
  1. import random
  2.  
  3. score = 0
  4.  
  5.  
  6. def deal_hand():
  7.     for _ in xrange(3):
  8.         random.shuffle(deck)
  9.         hand.append(deck.pop())
  10.  
  11.  
  12. def check_odds():
  13.     for n in hand:
  14.         if n % 2 == 0:
  15.             return False
  16.     return True
  17.  
  18.  
  19. for n in xrange(10000000):
  20.     deck = [_ for _ in range(1, 11)]
  21.     hand = []
  22.     deal_hand()
  23.     if (10 in hand) or check_odds():
  24.         score += 1
  25.  
  26. probability = (score/10000000.0) * 100
  27. print probability, " %"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement