I am getting really tired, so I am probably doing something dumb(disclaimer). below is a python function I am trying to test
# answer.py
#
# this function asks for a move and checks to see
# if it is a legal place to choose.
position = ['X','O',' ',' ',' ',' ',' ',' ',' '] # this line is for testing only
def answer():
guess = int(raw_input("please enter your move(enter here)"))
while guess - 1 not in range(9):
guess = int(raw_input("please enter a number chosen from 1-9(enter here)"))
while True:
if position[guess -1] in ('X', 'O'):
guess = int(raw_input("\nplease enter a different move, that space is already occupied(enter here)"))
else:
break
#return position[guess -1]
return 'hhhhh' # I added this return code to simply it
answer()
print answer()
this line below should run the function
answer()
here is where I am screwing something up. I thought the following line of code would print the return value. but it just seems to rerun the function once, then print the return vaue, why is it rerunning the function?
print answer()
isn't that the correct way to print a return value?