title: Having difficulty with my Monty Hall stimulator code (python)
body: <p><strong>What the Monty Hall game is:</strong></p>
  
  <p>The stage is set up with three large doors labeled #1, #2, and #3. Behind two of the doors is a goat. Behind the other door is a new car. You don’t know which door has the car, but Monty Hall wants you to pick a door. Suppose you pick door #1. Monty Hall then opens one of the other doors (say, door #3) and shows you that there’s a goat behind it. He then says: "I’ll give you a chance to change your mind. Do you want to change your mind and pick door number 2?" After you make a decision, they open the door you finally picked and you find out whether you’ve won a new car or a new goat. To clarify: the locations of the car and the goats are fixed before your game starts. Monty does not get a chance to switch things around in the middle of the game.</p>
  
  <p><strong>What I have to do:</strong> </p>
  
  <p>I need to create a stimulator of the game using Python <strong><em>3</em></strong>. I have to incorporate a random number generator. The program will ask the user for the Random Number generator seed. The goal of a random number generator is to be random. Before my program begins simulating “Let’s Make a Deal,” it's supposed to ask the user for an integer and set it as the seed. If the user gives an input that is not a number, the program should exit immediately by displaying "Seed is not a number!" IF the user gives a number for the input, the game will begin. The game will then ask the user how many games the user wants to run. If the user says 5, the game will repeat five times. Once the game runs the amount of times the user says (like 5), then the game will ask the user AGAIN how many times the user wants to play again.(I'm having difficulty with this looping the game to the number of times the user says and then asking the question once it's done). If the user says 'exit' anytime, the game immediately ends. When asked how many games the user wants to run, if the user does not input a number, the program will just say "Please enter a number" until the user finally enters a number. </p>
  
  <p><strong>What the program has to do:</strong></p>
  
  <p>The program will be easier because it will print the doors AND label which door has a goat or car. So it will display "G" "C" "G" where they will be shuffled for each game so if the program outputted: [C G G] the car would be in door one. Monty (in this case, Monty is just a variable) would "pick" a door where the program randomly generates a number that is either 1, 2, or 3. IF the user picks a door that has the car in it, the program will say the user should stick with the door they picked in order to win. If the user picks a door that has a goat, the program will say that the user should change the door they picked in order to pick the door with the car (I'm stuck at this part). After each set of games, the program gives a summary of how many times the player should have switched and how many times they should have stayed. If the number of games is less than or equal to 10, the program will print out the results of each game. If the result is greater than 10, it will just print the summary.</p>
  
  <p><strong>Example</strong></p>
  
  <p><em>If the input is:</em></p>
  
  <p>25</p>
  
  <p>5</p>
  
  <p>exit</p>
  
  <p><em>Output should be:</em></p>
  
  <p>Enter Random Seed:</p>
  
  <p>Welcome to Monty Hall Analysis</p>
  
  <p>Enter 'exit' to quit.</p>
  
  <p>How many tests should we run?</p>
  
  <p>Game 1</p>
  
  <p>Doors: ['G', 'C', 'G']</p>
  
  <p>Player Selects Door 1</p>
  
  <p>Monty Selects Door 3</p>
  
  <p>Player should switch to win.</p>
  
  <p>Game 2</p>
  
  <p>Doors: ['C', 'G', 'G']</p>
  
  <p>Player Selects Door 1</p>
  
  <p>Monty Selects Door 2</p>
  
  <p>Player should stay to win.</p>
  
  <p>Game 3</p>
  
  <p>Doors: ['G', 'C', 'G']</p>
  
  <p>Player Selects Door 2</p>
  
  <p>Monty Selects Door 1</p>
  
  <p>Player should stay to win.</p>
  
  <p>Game 4</p>
  
  <p>Doors: ['C', 'G', 'G']</p>
  
  <p>Player Selects Door 1</p>
  
  <p>Monty Selects Door 2</p>
  
  <p>Player should stay to win.</p>
  
  <p>Game 5</p>
  
  <p>Doors: ['G', 'C', 'G']</p>
  
  <p>Player Selects Door 3</p>
  
  <p>Monty Selects Door 1</p>
  
  <p>Player should switch to win.</p>
  
  <p>Stay Won 60.0% of the time.</p>
  
  <p>Switch Won 40.0% of the time.</p>
  
  <p>How many tests should we run?</p>
  
  <p>Thank you for using this program.</p>
  
  <p>I am a pretty beginner programmer who's trying to learn so sorry if this is confusing or does not make sense! I have a program so far and I know it's not very good. If someone could help me at all, that would be greatly appreciated. I'm very confused about the randomization aspect of it.</p>
  
  <p><strong>Here is what my program outputs</strong></p>
  
  <p>Enter Random Seed:</p>
  
  <p>Welcome to Monty Hall Analysis</p>
  
  <p>Enter exit to quit.</p>
  
  <p>How many tests should we run?</p>
  
  <p>Seed is not a number!</p>
  
  <p><strong><em>Here is my program:</em></strong></p>
  
  <pre><code>import random
  random_seed = input('Enter Random Seed:\n')
  try:
      random_seed = int(random_seed)
      print('Welcome to Monty Hall Analysis') 
      exit = input('Enter ''exit'' to quit.\n')
      tests = int(input('How many tests should we run?\n'))
      try:
         tests = int(tests)
         while True:
             select_door = ['G', 'C', 'G']
             player_door = input('Doors', random.shuffle(select_door))
             doors = [1, 2, 3]
             random.choice(doors)
             print('Player Selects Door', select_door)
             print('Monty Selects Door', random.choice(doors))
             if exit == 'exit':
                 print('Thank you for using this program.')
                 break
      except ValueError:
          print('Please enter a number:\n')
  except ValueError:
          print('Seed is not a number!')
  </code></pre>
  
  <p><strong><em>I know the code and my description isn't perfect, but hey I'm trying my best!</em></strong></p>