Boolean 35. Даны координаты двух различных полей шахматной доски x1, y1, x2, y2 (целые числа, лежащие в диапазоне 1–8). Проверить истинность высказывания: «Данные поля имеют одинаковый цвет».

Решение на Python 3

import random

x1,y1,x2,y2 = [random.randrange(1, 9) for i in range(0,4)]
c1 = (x1+y1)%2
c2 = (x2+y2)%2
print("x1: ", x1)
print("y1: ", y1)
print("The 1st cell is white: ",(c1==1))
print()
print("x2: ", x2)
print("y2: ", y2)
print("The 2nd cell is white: ",(c2==1))
print()
print("Cells have the same color: ",(c1==c2))