← Quiz: Logic: all 10 questions
Quiz: Logic · Question 8 of 10
What does this print? (code)
What does this print?
from itertools import product
rows = [(p, q) for p, q in product([True, False], repeat=2)
if ((not p) or q) and ((not q) or p)]
print(len(rows))
- A.1
- B.2
- C.3
- D.4
Answer & explanation
Correct answer: 2
(p → q) ∧ (q → p) is the biconditional, true when p and q have the same value: 2 rows.
Can you get the rest right without peeking?
Take the timed Quiz: Logic quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →