Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/python
- from random import choice
- def sample():
- boxes = [['gold', 'silver'], ['gold', 'gold']]
- box = choice(boxes)
- box.remove('gold')
- for box in boxes:
- if len(box) == 1:
- if box[0] == 'gold':
- return 'True'
- def main():
- x = []
- for i in range(10000):
- x.append(sample())
- print x.count('True')
- if __name__ == "__main__":
- import sys
- main()
- sys.exit()
Add Comment
Please, Sign In to add comment