Pypax
Pypax

Reputation: 113

Python Conditionals

Apparently:

if board[0][0] == X and board[1][1] == X and board[2][2] == X:
    pass

Is not the same as:

if board[0][0] and board[1][1] and board[2][2] == X:
    pass

How can I summarize this statement?

Thank you

Upvotes: 1

Views: 68

Answers (2)

Noor Ahmed Natali
Noor Ahmed Natali

Reputation: 523

You can use:

if (board[0][0] and board[1][1] and board[2][2]) == X: 
    pass

Upvotes: 0

Divyessh
Divyessh

Reputation: 2721

You can use this:

if board[0][0] == board[1][1] == board[2][2] == X:
    pass

Upvotes: 2

Related Questions