Answer the question
In order to leave comments, you need to log in
I can not solve the task in the exam. Typo?
Task with Yandex USE. Claimed to be a CAB answer, but I've double-checked and can't seem to get that solution. Am I missing something or is this a typo?
Answer the question
In order to leave comments, you need to log in
You don't understand something. Or you can't.
from itertools import product
def f(a, b, c):
return int(a and not b and not c or a and c)
print("A B C F")
for abc in product((0, 1), repeat=3):
print(*abc, f(*abc))
A B C F
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 1
A B C F
1 0 0 1
1 0 1 1
1 1 1 1
1 0
1 1
1 0
0 0
A B C F
1 0 0 1
1 0 1 1
C A B F
1 1 0 1
0 1 0 1
C A B F -> A B C F
0 1 1 0 -> 1 1 0 0
ABCF = [(a, b, c, f(a, b, c))
for a, b, c in product((0, 1), repeat=3)]
data = ((0, 1, 1, 0),
(1, 1, 0, 1),
(0, 1, 0, 1))
for x, y, z in permutations((0, 1, 2)):
crossdata = [(r[x], r[y], r[z], r[3]) for r in ABCF]
if all(r in crossdata for r in data):
print("ABC"[x], "ABC"[y], "ABC"[z])
something a bit complicated))
A*~B*~C+A*C = A*(~B*~C+C)=A*(~B+C)
final operation = conjunction, check by result units.
so A is the second column, since there is only 1 for rows 2 and 3.
similarly, (~B+C) should also give 1 for these rows, so B is in column 3 (negating 0 = 1, 1+1 = 1).
for C, column 1 remains.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question