For further actions, you may consider blocking this person and/or reporting abuse
Read next
Implementing a Perceptron from Scratch in Python
Daniel Azevedo -
Custom Toggle Button in iOS 18 - #30DaysOfSwift
Vaibhav Dwivedi -
Using Guard Clauses Instead of Try-Catch in Async/Await: A Clean Coding Technique for Readable and Maintainable Code 🦄🚀
muthu raja -
Dynamic Fonts in iOS 18 - #30DaysOfSwift
Vaibhav Dwivedi -
Top comments (3)
I have some feedback on your code!
First, Python 2 is no longer supported. You should really try to use Python 3 as much as possible, because after a few months Python 2 will no longer receive any security updates, etc.
There's a couple places where your code isn't formatted properly (e.g., spaces before
:
, using two spaces for indentation in some places and one space in others). You should be using an auto-formatter on-save so that you don't have to worry about getting this right, but still ensure that it's always right.A
break
after areturn
isn't necessary, becausereturn
exits out of the whole function.Your
check_rows()
doesn't look right. The firstif
usesi
s in the indexes, but the second one doesn't, and theelse
also having areturn
means that yourfor
loop will never get past its first iteration. (Same goes forcheck_column
)Also, just checking all three in a row/column/diagonal are
==
is too generous of a check, since"-" == "-"
! You probably want to check that all three are equal to a player's symbol, instead of just equal to each other.You don't need to say
== True
; you could sayif player_won_diagonal or player_won_column or player_won_row:
Thank you very much for the feedback,I really appreciate it.
Some comments may only be visible to logged-in visitors. Sign in to view all comments.