title: The local variable is referenced before the assigment
body: <p>The error i am recieving is UnboundLocalError: local variable 'this_mammal' referenced before assignment</p>
  <p>I have been practicing this stuff for possibly like a few days now but this stumped me. I've looked around for indents and everywhere i have this_mammal placed but it seems okay. I couldnt include the Mammal superclass and animal subclasses because i didnt have enough text to include all the code. Please let me know if thats necessary to include! I can try.</p>
  <pre><code>def select_which_mammal():
      print(&quot;Welcome to the Mammal Inventory Management System!&quot;)
      print()
      print(&quot;1. Cow&quot;)
      print(&quot;2. Cat&quot;)
      print(&quot;3. Dog&quot;)
      print(&quot;4. Human&quot;)
      print(&quot;5. Platypus&quot;)
      print(&quot;6. Echidna&quot;)
      print(&quot;7. Bat&quot;)
      print()
      selection = int(input(&quot;Enter the number for the mammal you would like to add:&quot;))
  
      while selection &lt; 1 or selection &gt; 7:
          print(&quot;ERROR: Selections must be 1-7.&quot;)
          selection = int(input(&quot;Enter the number for the mammal you would like to add:&quot;))
  
  def create_the_mammal(mammal_type):
      
      if mammal_type == 1: this_mammal = Mammal('Cow', 4, 3)
      
      elif mammal_type == 2: this_mammal = Mammal('Cat', 4, 9)
  
      elif mammal_type == 3: this_mammal = Mammal('Dog', 4, 6)
  
      elif mammal_type == 4: this_mammal = mammal(&quot;Human&quot;, 2, 14)
      
      elif mammal_type == 5: this_mammal = mammal(&quot;Platypus&quot;, 4, 3)
  
      elif mammal_type == 6: this_mammal = mammal(&quot;Echidna&quot;, 4, 3)
  
      elif mammal_type == 7: this_mammal = mammal(&quot;Bat&quot;, 2, 1)
  
      print(&quot;\nYour&quot;, this_mammal.get_name(), &quot;has been added to the system.\n&quot;)
      
      return this_mammal
  
  def choose_an_action(this_mammal): 
      print(&quot;Next, please choose an action for your &quot;, this_mammal.get_name() + &quot;.&quot;)
      print()
      print(&quot;1. Display the mammal's status&quot;)
      print(&quot;2. Hear the mammal's sound&quot;)
      print(&quot;3. Go out for a walk with your mammal&quot;)
      print(&quot;4. Breed your mammal&quot;)
      print()
      action = int(input(&quot;Enter the number for the action:&quot;))
  
      while action &lt; 1 or action &gt; 4:
          print(&quot;ERROR: Selections must be 1-4.&quot;)
          action = input(int(&quot;Enter the number for the action:&quot;))
  
      if action == 1: this_mammal.show_self()
  
      elif action == 2: this_mammal.make_sound()
  
      elif action == 3: this_mammal.ambulate()
  
      elif action == 4: this_mammal.reproduce()
  
  def main():
  
      new_mammal = select_which_mammal()
  
      this_mammal = create_the_mammal(new_mammal)
  
      choose_an_action(this_mammal)
  
  main()
  </code></pre>