title: Using a while loop to add and subtract a current location
body: <pre><code>def main():
      global currentX,currentY
      currentX = 0
      currentY = 0
      currentlocation = currentX,currentY
      print("Starting Location is", currentX,currentY)
      print()
  
      #Main menu dialouge
  
      print("Please select direction:")
      print("1, North;")
      print("2, East;")
      print("3, South;")
      print("4, West;")
      print("5, End this program")
  
      #Loop = to 1 so while loop will go on indefitly until option 5 is pressed.
      loop = 1
      #try: handles all errors along with except:
      try:
          while loop == 1:
              direction = input("--&gt; ")
              print()
              direction = int(direction)
              if direction == 1:
                  moveN = currentY + 1
                  print("Moved North.",currentlocation)
  
              elif direction == 2:
                  currentX + 1
                  print("Moved East.",currentlocation)
  
              elif direction == 3:
                  currentY - 1
                  print("Moved South.",currentlocation)
  
              elif direction == 4:
                  currentX - 1
                  print("Moved West.",currentlocation)
  
              elif direction == 5:
                  loop = 0
                  print("Final location is", currentlocation)
  
              else:
                      print("ERROR:", choice, "is an invalid input.\n"
                            "Enter a number from 1 to 5.")
      except: ValueError
      print("Please enter a whole number between 1-5")
  
  main()
  </code></pre>
  
  <p>I can't figure out why the loop doesn't add to the currentlocation. 
  I get an output like 
  Starting Location is 0 0</p>
  
  <pre><code>Please select direction:
  1, North;
  2, East;
  3, South;
  4, West;
  5, End this program
  --&gt; 3
  Moved South. (0, 0)
  --&gt; 4
  Moved West. (0, 0)
  </code></pre>