I am trying to get a program to return a coord that increases or decreases in either X or Y given an input of either X, -X, Y, or -Y. It starts at (0 , 0). When I run it however, it always returns (0 , 0). What am I doing wrong? Here is my code.
#!/usr/bin/python
#Simple Grid Display - B. Owens
def grid():
#Z is the X coord, C is the Y coord
global z
global c
z = 0
c = 0
print (“Which way would you like to move? X, -X, Y, or –Y?”)
a = raw_input()
if a == “X”:
z + 1
if a == “-X”:
z – 1
if a == “Y”:
c + 1
if a == “-Y”:
c – 1
print (z),(c)
grid()
grid()