So, I'm learning Python and decided to make a Tic Tac Toe game so that you can play it in console several times. And I thought the single best way to do so is to make everything in functions so you can call them over and over again after you finished playing... I didn't really do any progress 'cos after I try call in_def_player_1_move
variable it doesn't exist despite the fact I returned in function. What am I doing wrong?
def board():
game_board = [[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]
print(" a b c")
for count, row in enumerate(game_board):
print(count, row)
# player 1 turn function
def def_player_1_turn():
in_def_player_1_move = input()
return in_def_player_1_move
# start of the game
def def_do_u_want_2_play():
my_while = True
while my_while:
print("Do you want to play? (y/n)")
user_choice = input("")
if user_choice == "y":
my_while = False
print("Let's start!")
print("Crosses go first. Pick your square")
def_player_1_turn()
player_moves_while = True
while player_moves_while:
if in_def_player_1_move # why doesn't this variable appear??? I returned it
pass
elif user_choice == "n":
print("Bye!")
break
else:
print('ERROR: please enter your choice again')
def_do_u_want_2_play()