Inspiration

I was inspired to do this as a way to practice programming in python

What it does

You can play tictactoe with it

How we built it

I built it using python

Challenges we ran into

I ran into some challenges with error and indentation

Accomplishments that we're proud of

The fact that I was able to make the game

What we learned

How to make tic tac toe in python

What's next for Tic Tac Toe

Try and make new things in python to enhance my coding skills

```Board = {'7': '','8': '','9': '', '4': '','5': '','6':'', '1': '','2': '', '3':''} boardkey = [] for key in Board: boardkey.append(key) def BoardSpots(theboard): print(theboard['7'] +' |' + theboard['8'] + ' |' +theboard['9'] ) print('-+-+-') print(theboard['4'] +' |' + theboard['5'] + ' |' +theboard['6'] ) print('-+-+-') print(theboard['1'] +' |' + theboard['2'] + ' |' +theboard['3'] )

def tictactoe(): yourturn = 'X' count = 0

for i in range(10):
    BoardSpots(Board)
    print("It's your turn "+ yourturn + " Move to which place?")

    move = input()

    if Board[move] == '':
        Board[move] = yourturn
        count += 1
    else:
        print("This place is filled.\n move to which place?")
        continue

    if count >= 5:
        if Board['1'] == Board['2'] == Board['3'] != '':
            BoardSpots(Board)
            print("\nGame Over.\n")
            print(yourturn + " won")
            break
        elif Board['4'] == Board['5'] == Board['6'] != '':
            BoardSpots(Board)
            print("\nGame Over.\n")
            print(yourturn + " won")
            break
        elif Board['7'] == Board['8'] == Board['9'] != '':
            BoardSpots(Board)
            print("\nGame Over.\n")
            print(yourturn + " won")
            break
        elif Board['1'] == Board['4'] == Board['7'] != '':
            BoardSpots(Board)
            print("\nGame Over.\n")
            print(yourturn + " won")
            break
        elif Board['2'] == Board['5'] == Board['8'] != '':
            BoardSpots(Board)
            print("\nGame Over.\n")
            print(yourturn + " won")
            break
        elif Board['3'] == Board['6'] == Board['9'] != '':
            BoardSpots(Board)
            print("\nGame Over.\n")
            print(yourturn + " won")
            break
        elif Board['1'] == Board['5'] == Board['9'] != '':
            BoardSpots(Board)
            print("\nGame Over.\n")
            print(yourturn + " won")
            break
        elif Board['7'] == Board['5'] == Board['3'] != '':
            BoardSpots(Board)
            print("\nGame Over.\n")
            print(yourturn + " won")
            break

    if count == 9:
            print("\n Game Over \n")
            print("\n It's a Draw \n")
    if yourturn == 'X':
        yourturn = 'O'
    else:
        yourturn = 'X'
restart = input("Do you want to play again?")
if restart == 'Yes' or restart == 'yes':
    for key in boardkey:
        Board[key] = ''

        tictactoe()

if name == "main": tictactoe()```

Built With

Share this project:

Updates

Submission history