{"id":27397,"date":"2025-04-23T07:39:14","date_gmt":"2025-04-23T07:39:14","guid":{"rendered":"https:\/\/linux.how2shout.com\/?p=27397"},"modified":"2025-04-23T07:39:22","modified_gmt":"2025-04-23T07:39:22","slug":"game-tic-tac-toe-python-code-for-beginners","status":"publish","type":"post","link":"https:\/\/linux.how2shout.com\/game-tic-tac-toe-python-code-for-beginners\/","title":{"rendered":"Build Your First Game: Tic Tac Toe Python Code for Beginners"},"content":{"rendered":"\n<p>If you&#8217;re new to programming and want to create something fun while <strong>learning<\/strong> <strong>Python<\/strong>, building a <strong>Tic Tac Toe game is the perfect project. <\/strong>This <strong>classic <\/strong>game requires<strong> just a few basic programming concepts, <\/strong>but it delivers a complete, playable result that you can<strong> show off <\/strong>to friends and family. Let&#8217;s walk through <strong>how to create your own Tic Tac Toe game in Python<\/strong>, with code that&#8217;s easy to understand even if you&#8217;re starting.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-why-tic-tac-toe-is-perfect-for-learning-python\">Why Tic Tac Toe Is Perfect for Learning Python<\/h2>\n\n\n\n<p>Tic Tac Toe gives you the chance to practice several key programming concepts:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Working with functions<\/li>\n\n\n\n<li>Using conditional logic<\/li>\n\n\n\n<li>Handling user input<\/li>\n\n\n\n<li>Creating simple displays<\/li>\n\n\n\n<li>Implementing basic game logic<\/li>\n<\/ul>\n\n\n\n<p>Plus, it&#8217;s satisfying to build something you can play with when you&#8217;re done!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-setting-up-your-tic-tac-toe-project\">Setting Up Your Tic Tac Toe Project<\/h2>\n\n\n\n<p><strong>To get started<\/strong>, you&#8217;ll need Python installed on your computer. If you haven&#8217;t installed it yet, visit <a href=\"https:\/\/www.python.org\/downloads\/\" target=\"_blank\" rel=\"noreferrer noopener\">Python.org<\/a> and <strong>download the latest version.<\/strong><\/p>\n\n\n\n<p>Once you have Python set up, open your favorite<strong> text editor<\/strong> or IDE (like IDLE, VS Code, or PyCharm) and create a new file called. <code>tic_tac_toe.py<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-the-basic-structure-of-our-tic-tac-toe-game\">The Basic Structure of Our Tic Tac Toe Game<\/h2>\n\n\n\n<p>Before diving into the code, let&#8217;s understand what our game needs:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>A game board (we&#8217;ll use a simple list)<\/li>\n\n\n\n<li>A way to display the board<\/li>\n\n\n\n<li>Functions for player moves<\/li>\n\n\n\n<li>Logic to check for a win or a draw<\/li>\n\n\n\n<li>A main game loop<\/li>\n<\/ol>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Play our <a href=\"https:\/\/www.how2shout.com\/google-tic-tac-toe-4x4\">HTML-based Tic Tac Toe game with a 4&#215;4 grid board<\/a> for more extended play<\/p>\n<\/blockquote>\n\n\n\n<p>Let&#8217;s break down each component and build it step by step.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Creating the Game Board<\/h2>\n\n\n\n<p><strong>First<\/strong>, let&#8217;s create the game board using a list. In Tic Tac Toe, we need a 3\u00d73 grid, which we&#8217;ll represent using a list with 9 positions:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">def create_board():\n    return [' ' for _ in range(9)]<\/code><\/pre>\n\n\n\n<p>This function creates a list with <strong>9 empty spaces<\/strong>, which will represent our board positions from <strong>0 to 8:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\"> 0 | 1 | 2\n-----------\n 3 | 4 | 5\n-----------\n 6 | 7 | 8<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Displaying the Tic Tac Toe Board<\/h2>\n\n\n\n<p>Now, let&#8217;s create a function to display our board in a way that looks like a proper<strong> Tic Tac Toe grid:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">def display_board(board):\n    print(f\" {board[0]} | {board[1]} | {board[2]} \")\n    print(\"-----------\")\n    print(f\" {board[3]} | {board[4]} | {board[5]} \")\n    print(\"-----------\")\n    print(f\" {board[6]} | {board[7]} | {board[8]} \")<\/code><\/pre>\n\n\n\n<p>This function takes our board list and formats it to look like a <strong>Tic Tac Toe grid<\/strong> using the <strong>f-string<\/strong> feature in <strong>Python<\/strong>, which makes string formatting easy and readable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Handling Player Moves<\/h2>\n\n\n\n<p>Next, we need a way for players to make their moves. We&#8217;ll create a function that:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Takes input from the player<\/li>\n\n\n\n<li>Validates that the move is legal<\/li>\n\n\n\n<li>Updates the board<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">def make_move(board, position, player):\n    if board[position] == ' ':\n        board[position] = player\n        return True\n    return False\n\ndef player_move(board, player):\n    while True:\n        try:\n            position = int(input(f\"Player {player}, choose a position (0-8): \"))\n            if position &lt; 0 or position > 8:\n                print(\"Position must be between 0 and 8.\")\n                continue\n                \n            if make_move(board, position, player):\n                break\n            else:\n                print(\"That position is already taken!\")\n        except ValueError:\n            print(\"Please enter a number between 0 and 8.\")<\/code><\/pre>\n\n\n\n<p>The <code>make_move<\/code> function checks if a position is empty before placing a player&#8217;s mark. The <code>player_move<\/code> function handles getting input from the player, validating it, and ensuring they select a valid, empty position.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Checking for a Win or Draw<\/h2>\n\n\n\n<p>Now, we need to determine when someone has won or when the game ends in a draw. Here&#8217;s how we&#8217;ll check for a win:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">def check_win(board, player):\n    # Check rows\n    for i in range(0, 9, 3):\n        if board[i] == board[i+1] == board[i+2] == player:\n            return True\n            \n    # Check columns\n    for i in range(3):\n        if board[i] == board[i+3] == board[i+6] == player:\n            return True\n            \n    # Check diagonals\n    if board[0] == board[4] == board[8] == player:\n        return True\n    if board[2] == board[4] == board[6] == player:\n        return True\n        \n    return False\n\ndef check_draw(board):\n    return ' ' not in board<\/code><\/pre>\n\n\n\n<p>The <code>check_win<\/code> function checks all possible winning combinations &#8211; rows, columns, and diagonals. The <code>check_draw<\/code> function simply checks if there are any empty spaces left on the board.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Creating the Main Game Loop<\/h2>\n\n\n\n<p>Finally, let&#8217;s put everything together in our main game loop:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">def play_single_game():\n    board = create_board()\n    current_player = 'X'\n    \n    print(\"Welcome to Tic Tac Toe!\")\n    print(\"Positions are numbered from 0 to 8, as shown below:\")\n    print(\" 0 | 1 | 2 \")\n    print(\"-----------\")\n    print(\" 3 | 4 | 5 \")\n    print(\"-----------\")\n    print(\" 6 | 7 | 8 \")\n    print(\"\\n--- Game Starting ---\\n\")  # Add a clear separator\n    \n    # First move without showing the empty board\n    player_move(board, current_player)\n    \n    while True:\n        # Display board after the first move has been made\n        display_board(board)\n        \n        if check_win(board, current_player):\n            print(f\"Player {current_player} wins!\")\n            break\n            \n        if check_draw(board):\n            print(\"Game ends in a draw!\")\n            break\n            \n        # Switch players\n        current_player = 'O' if current_player == 'X' else 'X'\n        \n        # Get next player's move\n        player_move(board, current_player)\n    \n    play_again = input(\"Do you want to play again? (y\/n): \")\n    if play_again.lower() == 'y':\n        play_game()<\/code><\/pre>\n\n\n\n<p>This function creates a new board, sets the first player to &#8216;X&#8217;, and then enters a loop where players take turns until one of them wins or the game ends in a draw.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Complete Tic Tac Toe Python Code<\/h2>\n\n\n\n<p>Let&#8217;s put all these pieces together into our complete game:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">def create_board():\n    return [' ' for _ in range(9)]\n\ndef display_board(board):\n    print(f\" {board[0]} | {board[1]} | {board[2]} \")\n    print(\"-----------\")\n    print(f\" {board[3]} | {board[4]} | {board[5]} \")\n    print(\"-----------\")\n    print(f\" {board[6]} | {board[7]} | {board[8]} \")\n\ndef make_move(board, position, player):\n    if board[position] == ' ':\n        board[position] = player\n        return True\n    return False\n\ndef player_move(board, player):\n    while True:\n        try:\n            position = int(input(f\"Player {player}, choose a position (0-8): \"))\n            if position &lt; 0 or position > 8:\n                print(\"Position must be between 0 and 8.\")\n                continue\n                \n            if make_move(board, position, player):\n                break\n            else:\n                print(\"That position is already taken!\")\n        except ValueError:\n            print(\"Please enter a number between 0 and 8.\")\n\ndef check_win(board, player):\n    # Check rows\n    for i in range(0, 9, 3):\n        if board[i] == board[i+1] == board[i+2] == player:\n            return True\n            \n    # Check columns\n    for i in range(3):\n        if board[i] == board[i+3] == board[i+6] == player:\n            return True\n            \n    # Check diagonals\n    if board[0] == board[4] == board[8] == player:\n        return True\n    if board[2] == board[4] == board[6] == player:\n        return True\n        \n    return False\n\ndef check_draw(board):\n    return ' ' not in board\n\ndef play_single_game():\n    board = create_board()\n    current_player = 'X'\n    \n    print(\"Welcome to Tic Tac Toe!\")\n    print(\"Positions are numbered from 0 to 8, as shown below:\")\n    print(\" 0 | 1 | 2 \")\n    print(\"-----------\")\n    print(\" 3 | 4 | 5 \")\n    print(\"-----------\")\n    print(\" 6 | 7 | 8 \")\n    print(\"\\n--- Game Starting ---\\n\")  # Add a clear separator\n    \n    # First move without showing the empty board\n    player_move(board, current_player)\n    \n    while True:\n        # Display board after the first move has been made\n        display_board(board)\n        \n        if check_win(board, current_player):\n            print(f\"Player {current_player} wins!\")\n            break\n            \n        if check_draw(board):\n            print(\"Game ends in a draw!\")\n            break\n            \n        # Switch players\n        current_player = 'O' if current_player == 'X' else 'X'\n        \n        # Get next player's move\n        player_move(board, current_player)\n    \n    play_again = input(\"Do you want to play again? (y\/n): \")\n    if play_again.lower() == 'y':\n        play_game()\n\n# Start the game\nif __name__ == \"__main__\":\n    play_game()<\/code><\/pre>\n\n\n\n<p>Save this code to your <code>tic_tac_toe.py<\/code> file and run it by opening a terminal or command prompt, navigating to the file location, and typing:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Run the Game<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open your terminal or command prompt.<\/li>\n\n\n\n<li>Navigate to the folder where you saved <code>tic_tac_toe.py<\/code>.<\/li>\n\n\n\n<li>Run the game with:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">python tic_tac_toe.py<\/code><\/pre>\n\n\n\n<p>You\u2019ll see the board printed in your terminal, and the game will prompt you to take turns. You can check out the given screenshot to get an idea:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Taking Your Tic Tac Toe Game Further<\/h2>\n\n\n\n<p>Once you have the basic game working, here are some ways you could enhance it:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Add a Simple Computer Player<\/h3>\n\n\n\n<p>Create a Computer function:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">import random\n\ndef computer_move(board, computer_player):\n    # Get all available positions\n    available_positions = [i for i, spot in enumerate(board) if spot == ' ']\n    \n    if available_positions:\n        # Add a small delay to make it seem like the computer is \"thinking\"\n        print(f\"Computer ({computer_player}) is thinking...\")\n        time.sleep(1)\n        \n        # Choose a random position from available positions\n        position = random.choice(available_positions)\n        \n        print(f\"Computer ({computer_player}) chooses position {position}\")\n        make_move(board, position, computer_player)\n    else:\n        # This should never happen if check_draw works properly\n        print(\"No available positions!\")<\/code><\/pre>\n\n\n\n<p>After that, call it in the Loop function as shown below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">\n\ndef play_single_game(vs_computer=False):\n    board = create_board()\n    current_player = 'X'  # X always starts\n    human_player = 'X'    # Human is X by default\n    computer_player = 'O' # Computer is O by default\n    \n    # If playing vs computer, ask who goes first\n    if vs_computer:\n        choice = input(\"Do you want to be X (first) or O (second)? \").upper()\n        if choice == 'O':\n            human_player = 'O'\n            computer_player = 'X'\n            current_player = 'X'  # X still starts, but X is the computer\n    \n    print(\"\\nWelcome to Tic Tac Toe!\")\n    print(\"Positions are numbered from 0 to 8, as shown below:\")\n    print(\" 0 | 1 | 2 \")\n    print(\"-----------\")\n    print(\" 3 | 4 | 5 \")\n    print(\"-----------\")\n    print(\" 6 | 7 | 8 \")\n    print(\"\\n--- Game Starting ---\\n\")\n    \n    # First move\n    if current_player == human_player or not vs_computer:\n        player_move(board, current_player)\n    else:\n        computer_move(board, current_player)\n    \n    while True:\n        # Display board after move has been made\n        display_colored_board(board)\n        \n        if check_win(board, current_player):\n            if vs_computer:\n                if current_player == human_player:\n                    print(\"You win!\")\n                else:\n                    print(\"Computer wins!\")\n            else:\n                print(f\"Player {current_player} wins!\")\n            return current_player\n            \n        if check_draw(board):\n            print(\"Game ends in a draw!\")\n            return \"Draw\"\n            \n        # Switch players\n        current_player = 'O' if current_player == 'X' else 'X'\n        \n        # Get next player's move\n        if (vs_computer and current_player == computer_player):\n            computer_move(board, current_player)\n        else:\n            player_move(board, current_player)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-keep-score-across-multiple-games\">Keep Score Across Multiple Games<\/h3>\n\n\n\n<p>If you want to display the Score Board to make the game more interactive, add the following code just before the &#8220;<strong>#Start the game<\/strong>&#8221; section.  <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">def play_multiple_games():\n    # Initialize scores dictionary\n    scores = {'X': 0, 'O': 0, 'Draw': 0}\n    playing = True\n    \n    print(\"===== TIC TAC TOE TOURNAMENT =====\")\n    \n    while playing:\n        # Play a single game and get the result\n        result = play_single_game()\n        \n        # Update scores based on game result\n        scores[result] += 1\n        \n        # Display current scores\n        print(\"\\n----- SCOREBOARD -----\")\n        print(f\"Player X: {scores['X']} wins\")\n        print(f\"Player O: {scores['O']} wins\")\n        print(f\"Draws: {scores['Draw']}\")\n        print(\"---------------------\\n\")\n        \n        # Ask if players want to continue\n        play_again = input(\"Do you want to play another game? (y\/n): \")\n        if play_again.lower() != 'y':\n            playing = False\n    \n    # Display final results when done playing\n    print(\"\\n===== FINAL SCORES =====\")\n    print(f\"Player X: {scores['X']} wins\")\n    print(f\"Player O: {scores['O']} wins\")\n    print(f\"Draws: {scores['Draw']}\")\n    print(\"=======================\")\n    \n    # Announce the winner if there is one\n    if scores['X'] > scores['O']:\n        print(\"Player X wins the tournament!\")\n    elif scores['O'] > scores['X']:\n        print(\"Player O wins the tournament!\")\n    else:\n        print(\"The tournament ends in a tie!\")<\/code><\/pre>\n\n\n\n<p>After adding the code, replace  <strong>play_game()<\/strong> with<strong> play_multiple_games() <\/strong>in the<code> #Start the game<\/code> section as shown below. Now save the code and run it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\"># Start the game\nif __name__ == \"__main__\":\n    <strong>play_multiple_games() <\/strong><\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" loading=\"lazy\" decoding=\"async\" width=\"870\" height=\"658\" src=\"https:\/\/linux.how2shout.com\/wp-content\/uploads\/2025\/04\/Keep-Score-Across-Multiple-Games-Python-Tic-Tac-toe.webp\" alt=\"Keep Score Across Multiple Games Python Tic Tac toe\" class=\"wp-image-27400\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Add Color to Your Console Output<\/h3>\n\n\n\n<p>Replace the <code>display_board(board)<\/code> section with the <strong>given code,<\/strong> and then also in your <strong>main game loop<\/strong>, use <code>display_colored_board(board)<\/code> instead of <code>display_board(board)<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"python\" class=\"language-python\">def display_colored_board(board):\n    # Create a new board with colored X and O\n    colored_board = []\n    for spot in board:\n        if spot == 'X':\n            colored_board.append('\\033[91mX\\033[0m')  # Red X\n        elif spot == 'O':\n            colored_board.append('\\033[94mO\\033[0m')  # Blue O\n        else:\n            colored_board.append(' ')\n    \n    # Display the colored board\n    print(f\" {colored_board[0]} | {colored_board[1]} | {colored_board[2]} \")\n    print(\"-----------\")\n    print(f\" {colored_board[3]} | {colored_board[4]} | {colored_board[5]} \")\n    print(\"-----------\")\n    print(f\" {colored_board[6]} | {colored_board[7]} | {colored_board[8]} \")<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" loading=\"lazy\" decoding=\"async\" width=\"859\" height=\"844\" src=\"https:\/\/linux.how2shout.com\/wp-content\/uploads\/2025\/04\/Add-Color-to-Your-Console-Output-Tic-Tac-Toe-in-Python.webp\" alt=\"Add Color to Your Console Output Tic Tac Toe in Python\" class=\"wp-image-27401\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-complete-tic-tac-toe-code-along-with-score-board-color-and-computer-player\">Complete Tic Tac Toe Code along with Score Board, Color, and Computer Player<\/h3>\n\n\n\n<p>To make things easy, here is the full code to have a bit advance Tic Tac Toe game using Python code.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">import os\nimport random\nimport time\n\n# Enable ANSI colors on Windows\nif os.name == 'nt':\n    os.system('color')\n\ndef create_board():\n    return [' ' for _ in range(9)]\n\ndef display_board(board):\n    print(f\" {board[0]} | {board[1]} | {board[2]} \")\n    print(\"-----------\")\n    print(f\" {board[3]} | {board[4]} | {board[5]} \")\n    print(\"-----------\")\n    print(f\" {board[6]} | {board[7]} | {board[8]} \")\n\ndef display_colored_board(board):\n    # Create a new board with colored X and O\n    colored_board = []\n    for spot in board:\n        if spot == 'X':\n            colored_board.append('\\033[91mX\\033[0m')  # Red X\n        elif spot == 'O':\n            colored_board.append('\\033[94mO\\033[0m')  # Blue O\n        else:\n            colored_board.append(' ')\n    \n    # Display the colored board\n    print(f\" {colored_board[0]} | {colored_board[1]} | {colored_board[2]} \")\n    print(\"-----------\")\n    print(f\" {colored_board[3]} | {colored_board[4]} | {colored_board[5]} \")\n    print(\"-----------\")\n    print(f\" {colored_board[6]} | {colored_board[7]} | {colored_board[8]} \")\n\ndef make_move(board, position, player):\n    if board[position] == ' ':\n        board[position] = player\n        return True\n    return False\n\ndef player_move(board, player):\n    while True:\n        try:\n            position = int(input(f\"Player {player}, choose a position (0-8): \"))\n            if position &lt; 0 or position > 8:\n                print(\"Position must be between 0 and 8.\")\n                continue\n                \n            if make_move(board, position, player):\n                break\n            else:\n                print(\"That position is already taken!\")\n        except ValueError:\n            print(\"Please enter a number between 0 and 8.\")\n\ndef computer_move(board, computer_player):\n    # Get all available positions\n    available_positions = [i for i, spot in enumerate(board) if spot == ' ']\n    \n    if available_positions:\n        # Add a small delay to make it seem like the computer is \"thinking\"\n        print(f\"Computer ({computer_player}) is thinking...\")\n        time.sleep(1)\n        \n        # Choose a random position from available positions\n        position = random.choice(available_positions)\n        \n        print(f\"Computer ({computer_player}) chooses position {position}\")\n        make_move(board, position, computer_player)\n    else:\n        # This should never happen if check_draw works properly\n        print(\"No available positions!\")\n\ndef check_win(board, player):\n    # Check rows\n    for i in range(0, 9, 3):\n        if board[i] == board[i+1] == board[i+2] == player:\n            return True\n            \n    # Check columns\n    for i in range(3):\n        if board[i] == board[i+3] == board[i+6] == player:\n            return True\n            \n    # Check diagonals\n    if board[0] == board[4] == board[8] == player:\n        return True\n    if board[2] == board[4] == board[6] == player:\n        return True\n        \n    return False\n\ndef check_draw(board):\n    return ' ' not in board\n\ndef play_single_game(vs_computer=False):\n    board = create_board()\n    current_player = 'X'  # X always starts\n    human_player = 'X'    # Human is X by default\n    computer_player = 'O' # Computer is O by default\n    \n    # If playing vs computer, ask who goes first\n    if vs_computer:\n        choice = input(\"Do you want to be X (first) or O (second)? \").upper()\n        if choice == 'O':\n            human_player = 'O'\n            computer_player = 'X'\n            current_player = 'X'  # X still starts, but X is the computer\n    \n    print(\"\\nWelcome to Tic Tac Toe!\")\n    print(\"Positions are numbered from 0 to 8, as shown below:\")\n    print(\" 0 | 1 | 2 \")\n    print(\"-----------\")\n    print(\" 3 | 4 | 5 \")\n    print(\"-----------\")\n    print(\" 6 | 7 | 8 \")\n    print(\"\\n--- Game Starting ---\\n\")\n    \n    # First move\n    if current_player == human_player or not vs_computer:\n        player_move(board, current_player)\n    else:\n        computer_move(board, current_player)\n    \n    while True:\n        # Display board after move has been made\n        display_colored_board(board)\n        \n        if check_win(board, current_player):\n            if vs_computer:\n                if current_player == human_player:\n                    print(\"You win!\")\n                else:\n                    print(\"Computer wins!\")\n            else:\n                print(f\"Player {current_player} wins!\")\n            return current_player\n            \n        if check_draw(board):\n            print(\"Game ends in a draw!\")\n            return \"Draw\"\n            \n        # Switch players\n        current_player = 'O' if current_player == 'X' else 'X'\n        \n        # Get next player's move\n        if (vs_computer and current_player == computer_player):\n            computer_move(board, current_player)\n        else:\n            player_move(board, current_player)\n\ndef play_multiple_games():\n    # Initialize scores dictionary\n    scores = {'X': 0, 'O': 0, 'Draw': 0}\n    playing = True\n    \n    # Ask if playing against computer\n    vs_computer = input(\"Play against computer? (y\/n): \").lower() == 'y'\n    \n    print(\"===== TIC TAC TOE TOURNAMENT =====\")\n    \n    while playing:\n        # Play a single game and get the result\n        result = play_single_game(vs_computer)\n        \n        # Update scores based on game result\n        scores[result] += 1\n        \n        # Display current scores\n        print(\"\\n----- SCOREBOARD -----\")\n        print(f\"Player X: {scores['X']} wins\")\n        print(f\"Player O: {scores['O']} wins\")\n        print(f\"Draws: {scores['Draw']}\")\n        print(\"---------------------\\n\")\n        \n        # Ask if players want to continue\n        play_again = input(\"Do you want to play another game? (y\/n): \")\n        if play_again.lower() != 'y':\n            playing = False\n    \n    # Display final results when done playing\n    print(\"\\n===== FINAL SCORES =====\")\n    print(f\"Player X: {scores['X']} wins\")\n    print(f\"Player O: {scores['O']} wins\")\n    print(f\"Draws: {scores['Draw']}\")\n    print(\"=======================\")\n    \n    # Announce the winner if there is one\n    if scores['X'] > scores['O']:\n        print(\"Player X wins the tournament!\")\n    elif scores['O'] > scores['X']:\n        print(\"Player O wins the tournament!\")\n    else:\n        print(\"The tournament ends in a tie!\")\n\n# Start the game\nif __name__ == \"__main__\":\n    play_multiple_games()<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Common Beginner Errors When Building Tic Tac Toe in Python<\/h2>\n\n\n\n<p>As you work on your game, watch out for these common mistakes:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>List indices start at 0<\/strong>: Remember that Python lists start at index<strong> 0<\/strong>, which can be confusing when thinking about a game board.<\/li>\n\n\n\n<li><strong>Type conversion<\/strong>: Always convert user input to the correct type. Our game converts input to <code>int<\/code> for position selection.<\/li>\n\n\n\n<li><strong>Updating global variables<\/strong>: If you split your functions differently, make sure you&#8217;re updating the board properly between functions.<\/li>\n\n\n\n<li><strong>Edge cases<\/strong>: Make sure to handle invalid inputs and already-filled positions.<\/li>\n\n\n\n<li><strong>Double board display<\/strong>: In our updated code, we added a clear separator between the instruction board and the actual game, and we don&#8217;t display the empty board before the first move. This prevents the confusing double-board display that can happen when running the game.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Why Building Tic Tac Toe in Python is Great for Learning<\/h2>\n\n\n\n<p>By creating this simple game, you&#8217;ve practiced:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Working with lists and functions<\/li>\n\n\n\n<li>Using conditional statements<\/li>\n\n\n\n<li>Processing user input<\/li>\n\n\n\n<li>Creating loops<\/li>\n\n\n\n<li>Implementing game logic<\/li>\n<\/ul>\n\n\n\n<p>These are fundamental skills that will serve you well as you take on more complex Python projects. Plus, you now have a fun game you can play and modify to your liking!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Building a Tic Tac Toe game in Python is a good way to learn programming fundamentals while creating something enjoyable and interactive. The code we&#8217;ve created is straightforward but covers important Python concepts that you&#8217;ll use in future projects.<\/p>\n\n\n\n<p>The best way to learn is to experiment with the code &#8211; try implementing the enhancements we suggested, or come up with your own improvements. Maybe add a more intelligent computer player using basic AI techniques, or create a graphical interface using a library like Pygame.<\/p>\n\n\n\n<p>Whatever you choose to do next, this Tic Tac Toe project has given you a solid foundation in Python programming concepts and game development basics. <\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;re new to programming and want to create something fun while learning Python, building a Tic Tac Toe game is the perfect project. This classic game requires just a few basic programming concepts, but it delivers a complete, playable result that you can show off to friends and family. Let&#8217;s walk through how to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":27408,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","_mbp_gutenberg_autopost":false,"footnotes":""},"categories":[4],"tags":[2932,2923,31,3197],"class_list":{"0":"post-27397","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-linux","8":"tag-coding","9":"tag-python","10":"tag-tutorial","11":"tag-vs-code"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v22.9 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Build Your First Game: Tic Tac Toe Python Code for Beginners - LinuxShout<\/title>\n<meta name=\"description\" content=\"Learn to code a complete Tic Tac Toe game in Python with this step-by-step guide. Add AI opponents, score tracking, and colorful displays as you build your skills.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/linux.how2shout.com\/game-tic-tac-toe-python-code-for-beginners\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Build Your First Game: Tic Tac Toe Python Code for Beginners\" \/>\n<meta property=\"og:description\" content=\"Learn to code a complete Tic Tac Toe game in Python with this step-by-step guide. Add AI opponents, score tracking, and colorful displays as you build your skills.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/linux.how2shout.com\/game-tic-tac-toe-python-code-for-beginners\/\" \/>\n<meta property=\"og:site_name\" content=\"LinuxShout\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/how2shout\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-23T07:39:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-23T07:39:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/linux.how2shout.com\/wp-content\/uploads\/2025\/04\/Tic-Tac-Toe-Python-Code-for-Beginners.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1575\" \/>\n\t<meta property=\"og:image:height\" content=\"914\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Heyan Maurya\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@h2smedia\" \/>\n<meta name=\"twitter:site\" content=\"@h2smedia\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Heyan Maurya\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/game-tic-tac-toe-python-code-for-beginners\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/game-tic-tac-toe-python-code-for-beginners\\\/\"},\"author\":{\"name\":\"Heyan Maurya\",\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/#\\\/schema\\\/person\\\/102d73e20384ea409022d5bafddc0f72\"},\"headline\":\"Build Your First Game: Tic Tac Toe Python Code for Beginners\",\"datePublished\":\"2025-04-23T07:39:14+00:00\",\"dateModified\":\"2025-04-23T07:39:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/game-tic-tac-toe-python-code-for-beginners\\\/\"},\"wordCount\":1121,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/game-tic-tac-toe-python-code-for-beginners\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/linux.how2shout.com\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/Tic-Tac-Toe-Python-Code-for-Beginners.webp\",\"keywords\":[\"coding\",\"python\",\"tutorial\",\"vs code\"],\"articleSection\":[\"Linux\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/linux.how2shout.com\\\/game-tic-tac-toe-python-code-for-beginners\\\/#respond\"]}],\"copyrightYear\":\"2025\",\"copyrightHolder\":{\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/game-tic-tac-toe-python-code-for-beginners\\\/\",\"url\":\"https:\\\/\\\/linux.how2shout.com\\\/game-tic-tac-toe-python-code-for-beginners\\\/\",\"name\":\"Build Your First Game: Tic Tac Toe Python Code for Beginners - LinuxShout\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/game-tic-tac-toe-python-code-for-beginners\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/game-tic-tac-toe-python-code-for-beginners\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/linux.how2shout.com\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/Tic-Tac-Toe-Python-Code-for-Beginners.webp\",\"datePublished\":\"2025-04-23T07:39:14+00:00\",\"dateModified\":\"2025-04-23T07:39:22+00:00\",\"description\":\"Learn to code a complete Tic Tac Toe game in Python with this step-by-step guide. Add AI opponents, score tracking, and colorful displays as you build your skills.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/game-tic-tac-toe-python-code-for-beginners\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/linux.how2shout.com\\\/game-tic-tac-toe-python-code-for-beginners\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/game-tic-tac-toe-python-code-for-beginners\\\/#primaryimage\",\"url\":\"https:\\\/\\\/linux.how2shout.com\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/Tic-Tac-Toe-Python-Code-for-Beginners.webp\",\"contentUrl\":\"https:\\\/\\\/linux.how2shout.com\\\/wp-content\\\/uploads\\\/2025\\\/04\\\/Tic-Tac-Toe-Python-Code-for-Beginners.webp\",\"width\":1575,\"height\":914,\"caption\":\"Colorful Python Tic Tac Toe game code and board with AI opponent and score tracking features\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/game-tic-tac-toe-python-code-for-beginners\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/linux.how2shout.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Build Your First Game: Tic Tac Toe Python Code for Beginners\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/#website\",\"url\":\"https:\\\/\\\/linux.how2shout.com\\\/\",\"name\":\"LinuxShout\",\"description\":\"Find the open source solutions\",\"publisher\":{\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/#organization\"},\"alternateName\":\"Linux how2shout\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/linux.how2shout.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/#organization\",\"name\":\"LinuxShout\",\"url\":\"https:\\\/\\\/linux.how2shout.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/linux.how2shout.com\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Linux-Shout-Logo.png\",\"contentUrl\":\"https:\\\/\\\/linux.how2shout.com\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Linux-Shout-Logo.png\",\"width\":503,\"height\":349,\"caption\":\"LinuxShout\"},\"image\":{\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/how2shout\",\"https:\\\/\\\/x.com\\\/h2smedia\",\"https:\\\/\\\/instagram.com\\\/h2smedia\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/h2smedia\\\/\",\"https:\\\/\\\/www.pinterest.com\\\/how2shout\",\"https:\\\/\\\/youtube.com\\\/h2smedia\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/linux.how2shout.com\\\/#\\\/schema\\\/person\\\/102d73e20384ea409022d5bafddc0f72\",\"name\":\"Heyan Maurya\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b07b375c19891b0589da722cb1e3dff333ec63dd8467afc114611044e87cfe9a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b07b375c19891b0589da722cb1e3dff333ec63dd8467afc114611044e87cfe9a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b07b375c19891b0589da722cb1e3dff333ec63dd8467afc114611044e87cfe9a?s=96&d=mm&r=g\",\"caption\":\"Heyan Maurya\"},\"description\":\"I have a keen interest in all kinds of technologies, from consumer-tech to enterprise solutions. However, I am still trying to learn Linux and whatever the problems I face, trying to give solutions for the same, here...\",\"sameAs\":[\"https:\\\/\\\/www.how2shout.com\\\/\"],\"url\":\"https:\\\/\\\/linux.how2shout.com\\\/author\\\/heyan\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Build Your First Game: Tic Tac Toe Python Code for Beginners - LinuxShout","description":"Learn to code a complete Tic Tac Toe game in Python with this step-by-step guide. Add AI opponents, score tracking, and colorful displays as you build your skills.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/linux.how2shout.com\/game-tic-tac-toe-python-code-for-beginners\/","og_locale":"en_US","og_type":"article","og_title":"Build Your First Game: Tic Tac Toe Python Code for Beginners","og_description":"Learn to code a complete Tic Tac Toe game in Python with this step-by-step guide. Add AI opponents, score tracking, and colorful displays as you build your skills.","og_url":"https:\/\/linux.how2shout.com\/game-tic-tac-toe-python-code-for-beginners\/","og_site_name":"LinuxShout","article_publisher":"https:\/\/www.facebook.com\/how2shout","article_published_time":"2025-04-23T07:39:14+00:00","article_modified_time":"2025-04-23T07:39:22+00:00","og_image":[{"width":1575,"height":914,"url":"https:\/\/linux.how2shout.com\/wp-content\/uploads\/2025\/04\/Tic-Tac-Toe-Python-Code-for-Beginners.webp","type":"image\/webp"}],"author":"Heyan Maurya","twitter_card":"summary_large_image","twitter_creator":"@h2smedia","twitter_site":"@h2smedia","twitter_misc":{"Written by":"Heyan Maurya","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/linux.how2shout.com\/game-tic-tac-toe-python-code-for-beginners\/#article","isPartOf":{"@id":"https:\/\/linux.how2shout.com\/game-tic-tac-toe-python-code-for-beginners\/"},"author":{"name":"Heyan Maurya","@id":"https:\/\/linux.how2shout.com\/#\/schema\/person\/102d73e20384ea409022d5bafddc0f72"},"headline":"Build Your First Game: Tic Tac Toe Python Code for Beginners","datePublished":"2025-04-23T07:39:14+00:00","dateModified":"2025-04-23T07:39:22+00:00","mainEntityOfPage":{"@id":"https:\/\/linux.how2shout.com\/game-tic-tac-toe-python-code-for-beginners\/"},"wordCount":1121,"commentCount":0,"publisher":{"@id":"https:\/\/linux.how2shout.com\/#organization"},"image":{"@id":"https:\/\/linux.how2shout.com\/game-tic-tac-toe-python-code-for-beginners\/#primaryimage"},"thumbnailUrl":"https:\/\/linux.how2shout.com\/wp-content\/uploads\/2025\/04\/Tic-Tac-Toe-Python-Code-for-Beginners.webp","keywords":["coding","python","tutorial","vs code"],"articleSection":["Linux"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/linux.how2shout.com\/game-tic-tac-toe-python-code-for-beginners\/#respond"]}],"copyrightYear":"2025","copyrightHolder":{"@id":"https:\/\/linux.how2shout.com\/#organization"}},{"@type":"WebPage","@id":"https:\/\/linux.how2shout.com\/game-tic-tac-toe-python-code-for-beginners\/","url":"https:\/\/linux.how2shout.com\/game-tic-tac-toe-python-code-for-beginners\/","name":"Build Your First Game: Tic Tac Toe Python Code for Beginners - LinuxShout","isPartOf":{"@id":"https:\/\/linux.how2shout.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/linux.how2shout.com\/game-tic-tac-toe-python-code-for-beginners\/#primaryimage"},"image":{"@id":"https:\/\/linux.how2shout.com\/game-tic-tac-toe-python-code-for-beginners\/#primaryimage"},"thumbnailUrl":"https:\/\/linux.how2shout.com\/wp-content\/uploads\/2025\/04\/Tic-Tac-Toe-Python-Code-for-Beginners.webp","datePublished":"2025-04-23T07:39:14+00:00","dateModified":"2025-04-23T07:39:22+00:00","description":"Learn to code a complete Tic Tac Toe game in Python with this step-by-step guide. Add AI opponents, score tracking, and colorful displays as you build your skills.","breadcrumb":{"@id":"https:\/\/linux.how2shout.com\/game-tic-tac-toe-python-code-for-beginners\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/linux.how2shout.com\/game-tic-tac-toe-python-code-for-beginners\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linux.how2shout.com\/game-tic-tac-toe-python-code-for-beginners\/#primaryimage","url":"https:\/\/linux.how2shout.com\/wp-content\/uploads\/2025\/04\/Tic-Tac-Toe-Python-Code-for-Beginners.webp","contentUrl":"https:\/\/linux.how2shout.com\/wp-content\/uploads\/2025\/04\/Tic-Tac-Toe-Python-Code-for-Beginners.webp","width":1575,"height":914,"caption":"Colorful Python Tic Tac Toe game code and board with AI opponent and score tracking features"},{"@type":"BreadcrumbList","@id":"https:\/\/linux.how2shout.com\/game-tic-tac-toe-python-code-for-beginners\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/linux.how2shout.com\/"},{"@type":"ListItem","position":2,"name":"Build Your First Game: Tic Tac Toe Python Code for Beginners"}]},{"@type":"WebSite","@id":"https:\/\/linux.how2shout.com\/#website","url":"https:\/\/linux.how2shout.com\/","name":"LinuxShout","description":"Find the open source solutions","publisher":{"@id":"https:\/\/linux.how2shout.com\/#organization"},"alternateName":"Linux how2shout","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/linux.how2shout.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/linux.how2shout.com\/#organization","name":"LinuxShout","url":"https:\/\/linux.how2shout.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/linux.how2shout.com\/#\/schema\/logo\/image\/","url":"https:\/\/linux.how2shout.com\/wp-content\/uploads\/2020\/06\/Linux-Shout-Logo.png","contentUrl":"https:\/\/linux.how2shout.com\/wp-content\/uploads\/2020\/06\/Linux-Shout-Logo.png","width":503,"height":349,"caption":"LinuxShout"},"image":{"@id":"https:\/\/linux.how2shout.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/how2shout","https:\/\/x.com\/h2smedia","https:\/\/instagram.com\/h2smedia","https:\/\/www.linkedin.com\/company\/h2smedia\/","https:\/\/www.pinterest.com\/how2shout","https:\/\/youtube.com\/h2smedia"]},{"@type":"Person","@id":"https:\/\/linux.how2shout.com\/#\/schema\/person\/102d73e20384ea409022d5bafddc0f72","name":"Heyan Maurya","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b07b375c19891b0589da722cb1e3dff333ec63dd8467afc114611044e87cfe9a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b07b375c19891b0589da722cb1e3dff333ec63dd8467afc114611044e87cfe9a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b07b375c19891b0589da722cb1e3dff333ec63dd8467afc114611044e87cfe9a?s=96&d=mm&r=g","caption":"Heyan Maurya"},"description":"I have a keen interest in all kinds of technologies, from consumer-tech to enterprise solutions. However, I am still trying to learn Linux and whatever the problems I face, trying to give solutions for the same, here...","sameAs":["https:\/\/www.how2shout.com\/"],"url":"https:\/\/linux.how2shout.com\/author\/heyan\/"}]}},"_links":{"self":[{"href":"https:\/\/linux.how2shout.com\/wp-json\/wp\/v2\/posts\/27397","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linux.how2shout.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linux.how2shout.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linux.how2shout.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/linux.how2shout.com\/wp-json\/wp\/v2\/comments?post=27397"}],"version-history":[{"count":7,"href":"https:\/\/linux.how2shout.com\/wp-json\/wp\/v2\/posts\/27397\/revisions"}],"predecessor-version":[{"id":27526,"href":"https:\/\/linux.how2shout.com\/wp-json\/wp\/v2\/posts\/27397\/revisions\/27526"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linux.how2shout.com\/wp-json\/wp\/v2\/media\/27408"}],"wp:attachment":[{"href":"https:\/\/linux.how2shout.com\/wp-json\/wp\/v2\/media?parent=27397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linux.how2shout.com\/wp-json\/wp\/v2\/categories?post=27397"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linux.how2shout.com\/wp-json\/wp\/v2\/tags?post=27397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}