title: Python - Passing a function into another function
body: <p>I am solving a puzzle using python and depending on which puzzle I am solving I will have to use a special set of rules. How can I pass a function into another function in Python?</p>
  
  <p>Example</p>
  
  <pre><code>def Game(listA, listB, rules):
     if rules == True:
        do...
     else:
        do...
  
  def Rule1(v):
    if "variable_name1" in v:
        return False
    elif "variable_name2" in v:
        return False
    else:
        return True
  
  def Rule2(v):
    if "variable_name3" and "variable_name4" in v:
        return False
    elif "variable_name4" and variable_name1 in v:
        return False
    else:
        return True
  </code></pre>
  
  <p>This is just a pseudo code and therefore not specific but I get the code to compile but I need to know how to call the function <code>Game</code> and whether it's correctly defined since rules will be switched for either <code>Rule1(v)</code> or <code>Rule2(v)</code>.</p>