Hoping someone can help me with this. I think I need to use the try and except function in order to do what I need but im not creating an error for an exception to occur.
When a user enters a1 it looks at the a1 dictionary and finds an x so it does not satisfy the while loop as true. so it moves to else. I need to reask the question again and start over from the top of the while loop. Is it possible to trigger an exception just because something is false?
here is what I am working with
board = {'a1':'x','a2':'_','a3':'_','b1':'_','b2':'_','b3':'_','c1':' ','c2':' ','c3':' '}
def o_move():
print 'im over at o now'
def x_move():
ans = raw_input('Player x please Enter a location: ') #ask user for location
f = board[ans] #current value of dictionary location selected
while f is '_' or f is ' ':
board[ans] == 'x' #writes the user location selected to the dictionary
o_move() #everything was good, move on
break #break the loop
else:
print 'space not available Try again'
ans = raw_input('Player x please Enter a location: ') #ask again
x_move()