for X in 0,1:
for Y in 0,1:
for Z in 0,1:
print(int(not (Y or not X and Z) or Z))
Output:
1
0
print('X Y Z F')
for x in range(2):
for y in range(2):
for z in range(2):
print(x,y,z,int(not (y or not x and z) or z))
for X in 0,1:
for Y in 0,1:
for Z in 0,1:
print(int(not (Y or not X and Z) or Z))
Output:
1
1
0
1
1
1
0
1
print('X Y Z F')
for x in range(2):
for y in range(2):
for z in range(2):
print(x,y,z,int(not (y or not x and z) or z))