"Chess board - same color: Given two cells of a chessboard. If they are painted in one color, print the word YES, and if in a different color - NO" - Snackify python coding question

 

 


 

CODING QUESTION

Given two cells of a chessboard. If they are painted in one color, print the word YES, and if in a different color - NO.

The program receives the input of four numbers from 1 to 8, each specifying the column and row number, first two - for the first cell, and then the last two - for the second cell.

SOLUTION

x1=int(input())
y1=int(input())
x2=int(input())
y2=int(input())

if (x1%2==1 and y1%2==1) or (x1%2==0 and y1%2==0):
    a="black"
else:
   a="white"
if (x2%2==1 and y2%2==1) or (x2%2==0 and y2%2==0):
    b="black"
else:
   b="white"


if a==b:
    print('YES')
else:
    print('NO')

 

Input : 

1

1

2

6

Output : YES