title: updating a global list python
body: <p>Full disclosure -- this is my first stack overflow question. I searched around for a similar question for awhile but couldn't find one that helped me given my limited scope of knowledge (there were python global variable questions but the answers given were over my head).</p>
  
  <p>I'm new to programming and i'm learning python via python the hard way by Zed Shaw. I'm on exercise36 and my goal is to write my own text based game.</p>
  
  <p>The game starts with the following function</p>
  
  <pre><code>def start():
  global Your_HP
  Your_HP = 20
  global Your_Ammo
  Your_Ammo = 20
  global HP_Scan
  HP_Scan = 2
  global your_stats
  your_stats = [Your_HP, Your_Ammo, HP_Scan]
  
  print "You enter a room with two doors"
  print "Do you choose the Red Door\n...or the Blue door?"
  start_choice = raw_input("&gt; ")
  
  if "red" or "Red" in start_choice:
      monster_HP = 2
      monster_attack = 3
  
      red_one(your_stats, monster_attack, monster_HP)
  </code></pre>
  
  <p>The red_one function looks like this:</p>
  
  <pre><code>def red_one(your_stats, monster_attack, monster_HP):
  
      print "Immediately you notice a monster in the room"
      print "You point your rifle at the monster before you"
  
  
      shoot(Your_Ammo, monster_HP)
  
      if monster_HP &lt;= 0:
          print "You killed it!"
          print "You now have %d bullets left" % Your_Ammo
          print "You finally look around the room"
          print "There is a door going straight"
          print "There is a door going left"
  
          room_choose()
  
  
      elif monster_HP &gt; 0:
          print "The monster has %d HP" % monster_HP
          print "He stumbles, but not dead!"
          print "He shoots back at you with his lil pistol!"
  
          get_shot(monster_attack, Your_HP)
  
      else:
          dead('just because')
  </code></pre>
  
  <p>The script immediately runs the shoot function which looks like:</p>
  
  <pre><code>def shoot(Your_Ammo, monster_HP):
  
      print "---------"
      print "You have %d HP left" % Your_HP
      print "How many shots do you fire?"
      shots_fired = raw_input('&gt; ')
      shots_fired = int(shots_fired)
  
      Your_Ammo -= shots_fired
      monster_HP -= shots_fired
  
      return Your_Ammo, monster_HP
  </code></pre>
  
  <p>The problem is that when I run the script and shoot only 1 time, when I return to the start of <code>red_one</code>, the <code>Your_Ammo</code> and <code>monster_HP</code> variables revert to their original values instead of the updated one i'm returning from <code>shoot</code></p>
  
  <p>I've tried moving where I'm declaring the global variables (initially declaring outside of all functions instead of in <code>start</code>) and I just get an "x variable is local and global" error.</p>
  
  <p>I know global variables in general are not always the best idea, so I'm just hoping someone can break this down for me in an elegant way and provide a helpful solution, regardless of whether or not it includes a global variable. </p>
  
  <p>Ideally, I'd like to update the variables in the <code>your_stats</code> list throughout the course of the game. Essentially, from any function in the game, I want to be able to return any variable within the <code>your_stats</code> list so I can use that variable as an argument for other functions until the player runs out of HP or ammo.</p>
  
  <p>Sorry this post was a bit verbose! Any help is really appreciated!</p>