Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to print tic tac toe border on terminal in python

the_board = {"top-L": " ", 'top-M': ' ', 'top-R': ' ',
            'mid-L': ' ', 'mid-M': ' ', 'mid-R': ' ',
            'low-L': ' ', 'low-M': ' ', 'low-R': ' '}

def printboard(board):
    print(' {} | {} | {} '.format(board['top-L'], board['top-M'], board['top-R']))
    print('---+---+---')
    print(' {} | {} | {} '.format(board['mid-L'], board['mid-M'], board['mid-R']))
    print('---+---+---')
    print(' {} | {} | {} '.format(board['low-L'], board['low-M'], board['low-R']))
    
printboard(the_board)   #call the printboard for the_board    


Output :

   |   |   
---+---+---
   |   |   
---+---+---
   |   |  

 
PREVIOUS NEXT
Tagged: #print #tic #tac #toe #border #terminal #python
ADD COMMENT
Topic
Name
3+2 =