Ctrl K

Is the Chess Square Light

Easy
A chessboard square is given as a two-character string square: first the file, a letter from a to h, then the rank, a digit from 1 to 8. The corner square a1 is dark, and squares sharing a side always have opposite colors. Return True if square is light and False if it is dark.
Example 1
square='d1' → True

The white queen starts the game on d1, which is a light square.

Example 2
square='h8' → False

h8 sits on the same long diagonal as a1, so it is dark.

Example 3
square='c4' → True
Constraints
  • len(square) == 2
  • 'a' ≤ square[0] ≤ 'h'
  • '1' ≤ square[1] ≤ '8'
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsValue of a Roman Numeral EasySum of Binary Strings EasySpreadsheet Column Label EasySpreadsheet Column Index EasyCounting Off by Threes and Fives Easy
loading Python…
Input
square='d1'
Expected
True

Run checks the first 3 tests in your browser. Submit checks all 67 tests on the server, hidden ones included.