Oct-13-2017, 06:42 PM
(This post was last modified: Oct-13-2017, 06:46 PM by goldtiger6.)
PYTHON 3!!
I'm working on something for school and I can't figure out why my code is not printing "NO" or "YES" when the input is "2 2 2 5". I've tried to fix is as best as I could but nothing seemed to work. Here is the problem I was given.
Given two squares of a chessboard. If they are painted in the same color, print YES, otherwise print NO.
The program receives four integers from 1 to 8, each specifying the column and row number, first two - for the first square, and then the last two - for the second square.
I'm working on something for school and I can't figure out why my code is not printing "NO" or "YES" when the input is "2 2 2 5". I've tried to fix is as best as I could but nothing seemed to work. Here is the problem I was given.
Given two squares of a chessboard. If they are painted in the same color, print YES, otherwise print NO.
The program receives four integers from 1 to 8, each specifying the column and row number, first two - for the first square, and then the last two - for the second square.
a = int(input()) b = int(input()) c = int(input()) d = int(input()) if (a + b) % 2 == 0: if (c + d) % 2 == 0: print("YES") elif (a + b) % 2 != 0: if (c + d) % 2 != 0: print("YES") else: print("NO")Thanks!