from __future__ import division
from scipy import *

cards = [["black","white"], ["black","black"], ["white","white"]]
total_experiments = 100000

experiment_count = 0
success_count = 0
for i in xrange(total_experiments):
    card_index = random.randint(3) # Select random card
    side_index = random.randint(2) # Select random side
    # Test if the visible side is white
    if cards[card_index][side_index] == 'white':
        # Test if the invisible side is also white
        if cards[card_index][1-side_index] == 'white':
            success_count += 1
        experiment_count += 1

print "Theoretical result: 2/3"
print "Empirical result: ", success_count / experiment_count

