This Tic-Tac-Toe win condition is driving me crazy... help?

Hey! Im like… 8 months into coding (so still pretty new lol) and Im currently working on a Tic-Tac-Toe game! I’ve got most of the code finished, i just need to make the win condition… and that is making me go mad. Any suggestions?

p.s. Im sorry if my code is an eye sore ;-;

blanksheet = "|1|2|3|\n|4|5|6|\n|7|8|9|"
sheet = blanksheet
print(sheet)

gone = []
turn = 0
def play(XO, player):
  global turn
  global sheet
  while True:
    num = input("\n"+player+" enter an available number where you want to put an "+XO+".\n > ")

    try:
      num = int(num)

    except ValueError:
      print("Not a valid number, try again.")
      continue

    if num < 1 or num > 9:
      print("Number not in correct range, try again.")
      continue
  
    if num in gone:
      print("Number already used, try again.")
      continue

    gone.append(num)
    turn += 1
    sheet = sheet.replace(str(num),XO)
    print(sheet)
    break

win = "h"
def checkplay():
  while not win == "Xwin" or win == "Owin":
  
    if turn % 2 == 0:
      play("X","Player 1")
    
    else:
      play("O","Player 2")

checkplay()