Ask coding questions

← Back to all posts
need help
BEEEEEEMO (1)

hey I wrote this tic tac toe code by the help of this tutorial:
https://www.youtube.com/watch?v=BHh654_7Cmw
and some errors keep showing up :(
can you type in 1, 2 and 3 so you can see the error message aswell and maybe help me out?

Commentshotnewtop
heyitsmarcus (287)

Hey @BEEEEEEMO,

The error was in your print statement on line 33. If you look in that console output, the last line has:

print (winner) + " won"

That confused the interpreter because print in Python3 must be wrapped in parenthesis, and so it's obvious to me that you're trying to concatenate the variable winner and the string " won" together. But, the way that it's written currently, the Python interpreter sees it as you trying to concatenate the output of the print() statement (which has a NoneType) and the string " won" which cannot be done.

It's a seriously easy fix, though. Just put the + " won" inside the parenthesis with the winner variable:

print (winner + " won")

And now your code compiles and a winner becomes you! :)

If this solves your problem, please consider marking my answer as the accepted answer to close this question. If you have more questions about this, I'll continue to answer them.

BEEEEEEMO (1)

@heyitsmarcus how could i oversee that! xd
Thank you buddy