title: NameError: global name 'category' is not defined
body: <p>I am making a Hangman Game and having trouble. Ok every time I go to edit this and save my edits I get a red mark saying I need more details not just code so this is my more details. Please do not delete it or I cannot edit my post. :)</p>
  
  <p>My error is, </p>
  
  <blockquote>
    <p>"NameError: global name 'category' is not defined"  </p>
  </blockquote>
  
  <pre><code>#Hangman Game V1 by (My name)
  
  import random
  import time
  
  play_again = 'Yes'
  
  #Categorys
  
  animals = ['alligator', 'barracuda', 'cougar', 'cheetah', 'dolphin',      'falcon', 'gorilla', 'penguin', 'salmon', 'wombat']
  
  olympics = ['archery', 'badminton', 'cycling', 'rowing', 'fencing', 'gymnastics', 'sailing', 'tennis', 'swimming',
              'volleyball']
  
  countries = ['china', 'america', 'mexico', 'russia', 'sweden', 'canada', 'spain', 'korea', 'japan', 'france']
  
  
  def intro():
      print ''
      print 'Welcome to Hangman by (My name)!'
      print ''
      print ''
  
  
  def pick_category():
      category = raw_input('First, choose a category by typing in it\'s name. Your options are: Animals, Olympics, &amp; '\
                           'Countries!')
      print ''
      print 'You chose the category ' + category + '.'
      return category
  
  def choose_word():
      print ''
      print 'Now I will pick the secret word from your category.'
      print ''
      print '...'
      time.sleep(1)
  
      if category == 'Animals':
          secret_word = random.choice(animals)
  
      if category == 'Olympics':
          secret_word = random.choice(olympics)
  
      if category == 'Countries':
          secret_word = random.choice(countries)
  
      print ''
      print 'Alright, I have chosen the word!'
      #for testing purposes
      print secret_word
  </code></pre>
  
  <p>while play_again: 
       intro()
       pick_category()
       choose_word()</p>