theBoard = {'top-L': ' ', 'top-M': ' ', 'top-R': ' ',
            'mid-L': ' ', 'mid-M': ' ', 'mid-R': ' ',
            'low-L': ' ', 'low-M': ' ', 'low-R': ' '}
def printBoard(board):
    print(board['top-L'] + '|' + board['top-M'] + '|' + board['top-R'])
    print('-+-+-')
    print(board['mid-L'] + '|' + board['mid-M'] + '|' + board['mid-R'])
    print('-+-+-')
    print(board['low-L'] + '|' + board['low-M'] + '|' + board['low-R'])

def choices(board):
    L = []
    return theBoard.keys()
    # h11: instead of just returning theBoard.keys(), loop through theBoard.keys()
    #      and if the value is ' ' then append to L. And return L at the end.

def takeTurn(board, player):
    print('Whose turn:', player)
    print('Pick a choice from:', choices(board))
    choice = input('')
    while not (choice in theBoard) or theBoard[choice] != ' ':
        print('Invalid choice...')
        print('Pick a choice from:', choices(board))
        choice = input('')
    theBoard[choice] = player

def win(board):
  if board['top-L'] == board['top-M'] and board['top-M'] == board['top-R'] and board['top-L'] != ' ':
    return True
  # h11: put in the rest of the winning conditions: 7 more, 7 more if's
  return False

player = 'x'

for i in range(9):
  print('Here is the board...')
  printBoard(theBoard)
  takeTurn(theBoard, player)

  if win(theBoard):
    printBoard(theBoard)
    print('You won!')
    break

  if player == 'x':
    player = 'o'
  else: 
    player = 'x'

# h11: if it was a tie, then tell them it was a tie
#      if win(theBoard) == False, then tie
printBoard(theBoard)
