Skip to content

Latest commit

 

History

History
22 lines (18 loc) · 467 Bytes

untitled-34.md

File metadata and controls

22 lines (18 loc) · 467 Bytes

1812. Determine Color of a Chessboard Square

class Solution:
    def squareIsWhite(self, c: str) -> bool:
        w = c[0]
        row = int(c[1]) 
        col = ord(w) - ord("a") + 1
        
        if row %2 == 0 :
            if col%2== 0 :
                return False
            else:
                return True
            
        else:
            if col%2== 0 :
                return True
            else:
                return False