Boolean14. Three integers are given: A, B, C. Check the truth of the statement: "Exactly one of the numbers A, B, C is positive".

Solution in Python 3:

import random
A = random.randrange(-10,10)
B = random.randrange(-10,10)
C = random.randrange(-10,10)
print("A = ", A)
print("B = ", B)
print("C = ", C)
a = (A>0)
b = (B>0)
c = (C>0)
x = (a and not b and not c) \
or (not a and b and not c) \
or (not a and not b and c)
print("A is positive: ", a)
print("B is positive: ", b)
print("C is positive: ", c)
print("Exactly one of the numbers A, B, C is positive: ", x)