0

Given a set of Boolean conditions A, B, C and D. a. Give a truth-value assignment for A, B, C and D that can make the expression �̅∨ � ∨ �̅∨ � to be evaluated as false.

I cannot understand what means "to give a truth- value assignment.

I tried in Python this code:

if a != a or b or c != c or d:
       print("True")
   else:
      print ("False")
Output
 False
  • Do the answers to this [question](https://stackoverflow.com/questions/20002503/why-does-a-x-or-y-or-z-always-evaluate-to-true-how-can-i-compare-a-to-al) help at all? – quamrana Sep 12 '22 at 08:54

1 Answers1

0

a!=a is always false because a statement cant be True and False at the same time. Use (not a) instead.

Your example should look like this:

if not a or b or not c or d:
       print("True")
   else:
      print ("False")
alanturing
  • 214
  • 1
  • 8
  • What is the difference between a != a and not a? – Αθανάσιος Σουλιώτης Sep 12 '22 at 09:03
  • `a!=a` checks if `a` is not equal to `a`. But For example if `a` is `True` `a!=a` would evaluate to `True!=True` (`True` is not equal to `True`) which is `False` and if `a` is `False` `a!=a` would evaluate to `False!=False` (`False` is not equal to `False`) which is `False`. So `a!=a` is always `False`. You want to invert `a` which you can do with `not`. If `a` is `True` `not a` is `False` and vice versa. I hope that helped. @ΑθανάσιοςΣουλιώτης – alanturing Sep 12 '22 at 09:09
  • Thanks alot! Can I also do it like that in order to evaluate it as False? a = 3 b = 0 c= 9 d= 0 print(bool(not a or b or not c or d)) Output = False – Αθανάσιος Σουλιώτης Sep 12 '22 at 09:30
  • @ΑθανάσιοςΣουλιώτης Yes. Python evaluates Integer as follows: `0` is `False` and every other number is `True`. – alanturing Sep 12 '22 at 10:57