title: Python - How to save functions
body: <p>I´m starting in python. I have four functions and are working OK. What I want to do is to save them. I want to call them whenever I want in python.</p>
  
  <p>Here's the code my four functions:</p>
  
  <pre><code>import numpy as ui
  
  
  def simulate_prizedoor(nsim):
      sim=ui.random.choice(3,nsim)
      return sims
  
  def simulate_guess(nsim):
          guesses=ui.random.choice(3,nsim)
          return guesses
  
  def goat_door(prizedoors, guesses):
  
  
          result = ui.random.randint(0, 3, prizedoors.size)
          while True:
              bad = (result == prizedoors) | (result == guesses)
              if not bad.any():
                  return result
              result[bad] = ui.random.randint(0, 3, bad.sum())
  
  def switch_guesses(guesses, goatdoors):
  
  
              result = ui.random.randint(0, 3, guesses.size)
              while True:
                  bad = (result == guesses) | (result == goatdoors)
                  if not bad.any():
                      return result
                  result[bad] = ui.random.randint(0, 3, bad.sum())
  </code></pre>