Jump to content
I'm following along with a tutorial on how to program in python and make a game of tic tac toe.

I'm not using the same version of Python buy I still can't figure out why this si not working.

Please help, I'm still a  programming noob :

 

ps i am not done the program.

 

 

 

 

Link to comment
https://linustechtips.com/topic/43398-python-invalid-syntax-error/
Share on other sites

Link to post
Share on other sites

Error message?

 

e: I would double check the indentation. Python relies heavily on it, so chances are, that's what's causing it.

Interested in Linux, SteamOS and Open-source applications? Go here

Gaming Rig - CPU: i5 3570k @ Stock | GPU: EVGA Geforce 560Ti 448 Core Classified Ultra | RAM: Mushkin Enhanced Blackline 8GB DDR3 1600 | SSD: Crucial M4 128GB | HDD: 3TB Seagate Barracuda, 1TB WD Caviar Black, 1TB Seagate Barracuda | Case: Antec Lanboy Air | KB: Corsair Vengeance K70 Cherry MX Blue | Mouse: Corsair Vengeance M95 | Headset: Steelseries Siberia V2

 

 

Link to post
Share on other sites

Right.

 

This is just a complete guess, but try indenting these lines further:

 

    else:        print 'This spot is taken'

 

To line up with the if statement inside the second While loop. I'm guessing that's used to check if the random number generated is taken or not (user input doesn't have that problem).

Interested in Linux, SteamOS and Open-source applications? Go here

Gaming Rig - CPU: i5 3570k @ Stock | GPU: EVGA Geforce 560Ti 448 Core Classified Ultra | RAM: Mushkin Enhanced Blackline 8GB DDR3 1600 | SSD: Crucial M4 128GB | HDD: 3TB Seagate Barracuda, 1TB WD Caviar Black, 1TB Seagate Barracuda | Case: Antec Lanboy Air | KB: Corsair Vengeance K70 Cherry MX Blue | Mouse: Corsair Vengeance M95 | Headset: Steelseries Siberia V2

 

 

Link to post
Share on other sites

Not sure... but I did tab it into the opponent while loop.

Right.

 

This is just a complete guess, but try indenting these lines further:

 

 

    else:
        print 'This spot is taken'

 

To line up with the if statement inside the second While loop. I'm guessing that's used to check if the random number generated is taken or not (user input doesn't have that problem).

 

Then I saw that I forgot to put brackets around my prints (new feature of python 3.3.2 or something :P)

And now I am getting this error  

 

Screenshot: http://prntscr.com/1jrrd6

 

Link to post
Share on other sites

Right.

 

This is just a complete guess, but try indenting these lines further:

    else:        print 'This spot is taken'

To line up with the if statement inside the second While loop. I'm guessing that's used to check if the random number generated is taken or not (user input doesn't have that problem).

Not sure... but I did tab it into the opponent while loop.

 

Then I saw that I forgot to put brackets around my prints (new feature of python 3.3.2 or something  :P)

And now I am getting this error  

 

Screenshot: http://prntscr.com/1jrrd6

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×