Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- G="gold"
- S="silver"
- boxes=[[G,G],[G,S],[S,S]];
- count = 0;
- count2 = 0;
- for i in xrange(100000):
- box = random.choice(boxes)
- i = random.randrange(2)
- ball1 = box[i]
- ball2 = box[i-1]
- if (ball1 == G):
- count += 1
- if (ball2 == G):
- count2 += 1
- print (1.0*count2)/(1.0*count)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement