robertvari

The door problem

Jun 5th, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. import random
  2.  
  3. player1_results = []
  4. player2_results = []
  5. for _ in range(10):
  6.     doors1 = [1, 0, 0]
  7.  
  8.     # shuffle doors
  9.     random.shuffle(doors1)
  10.  
  11.     # player1 picks a door
  12.     player1_choice = random.choice(doors1)
  13.     player1_results.append(player1_choice)
  14.  
  15.     # new doors for player 2 wit two options
  16.     doors2 = [1, 0]
  17.     random.shuffle(doors2)
  18.  
  19.     player2_choice = random.choice(doors2)
  20.     player2_results.append(player2_choice)
  21.  
  22. print(player1_results)
  23. print(player2_results)
Advertisement
Add Comment
Please, Sign In to add comment