Create a while
loop like this.
def run()
clear()
#check_win() should return true if there is a winner or false if not
while(check_win()==False): #if there is nobody win, continue this loop
if turn == 0: # X's move
runX()
turn = 1 # the next turn will be O's
elif turn == 1: # O's move
runO()
turn = 0 # the next turn will be O's
#here after the loop, we check for the winner
if(turn == 0):
winner = O #because the last move is O's
else:
winner = X
def clear():
#reset all variables here
if __name__ == "__main__": #maybe you miss this line
while(True):
play_again = int(input("play again? 1: OK, 0: No"))
if play_again == 1:
run()
else:
break
9
solved I want my python program to loop without using a function