title: How to assign a variable name from a list then delete it?
body: <p>I want to create a function where it takes a list of names entered by the user. If there is an even number of players, it will randomly print out the names until there is no more names left. If there is an odd number, it will assign a variable name to the last name entered, then delete it from the list. Then it will do the same as the even number of players. I want to be able to use the last name later on in the program. </p>
  
  <p>Here's what I have so far. It is giving me an error reading, </p>
  
  <blockquote>
    <p>"raise ValueError, "empty range for randrange() (%d,%d, %d)" %
    (istart, istop, width)"</p>
  </blockquote>
  
  <pre><code>def randName(teamNames):
      if len(teamNames) % 2 ==0:
          randomname = random.randrange(0, len(teamNames))
          return teamNames.pop(randomname)
      else:
          lastName = teamNames[-1]
          teamNames.pop()
  </code></pre>