comp-think / 2018-2019

The GitHub repository containing all the material related to the Computational Thinking and Programming course of the Digital Humanities and Digital Knowledge degree at the University of Bologna (a.a. 2018/2019).
Other
30 stars 8 forks source link

Lecture "Programming languages", exercise 1 #9

Open essepuntato opened 5 years ago

essepuntato commented 5 years ago

What is the boolean value of not (not True or False and True) or False?

AriannaPizzicori commented 5 years ago

not (not True or False and True) or False not (False or False) or False not False or False True or False True

dersuchendee commented 5 years ago

Not true or false and true= false and true= false

Not (false)= true

True or false= true

giuliapl commented 5 years ago

not (not True or False and True) or False not (False or Flase and True) or False not (False and True) or False not (False) or False True or False = True

delfimpandiani commented 5 years ago

Rules to keep in mind:

Order of operations (without counting brackets):

  1. not
  2. and
  3. or

False and True = False True and False = False False or True = True True or False = True

Then:

not (not True or False and True) or False since not True = False --> not (False or False and True) or False since False and True = False -> not (False or False) or False since False or False = False --> not (False) or False since not False = True --> True or False since True or False = True --> True

True!

lisasiurina commented 5 years ago

not (not True or False and True) or False?--> not (False or False and True) or False--> not (False or False) or False--> not False or False--> True or False = True

True

federicabologna commented 5 years ago

not (not True or False and True) or False not (False or False and True) or False not (False or False) or False not False or False True or False True

Totaro1996 commented 5 years ago

not (not True or False and True) or False not (False or False and True) or False not (False or False) or False not False or False True or False True

EleonoraPeruch commented 5 years ago

ex 1 programming languages

tceron commented 5 years ago

In round brackets the rules are:

No brackets: First - not operation Second - and operation Third - remaining or operations

Therefore, the boolean value of not (not True or False and True) or False is: not (not True or False) or False not (False) or False True or False True

saraarmaroli commented 5 years ago

not (not true or false and true) or false not (false or false and true ) or false not (flase or false) or false not (false) or false true or false true

MattiaSpadoni commented 5 years ago

not (not true or false and true) or false

friendlynihilist commented 5 years ago
  1. not (not True or False and True) or False
  2. not (False or False and True) or False
  3. not (False or False) or False
  4. True or False
  5. True

First of all we need to execute operations in round branches and, in particular, not True. Then we resolve the and operator. Then the not False and, finally, the or operator.

ilsamoano commented 5 years ago

What is the boolean value of not (not True or False and True) or False?

not (not True or False and True) or False not (False or False) or False not False or False True or False True

SeverinJB commented 5 years ago

{not[(not true) or (false and true)]} or false {not[false or (false and true)]} or false {not[false or false]} or false {not false} or false true or false true

hizclick commented 5 years ago

TRUE

Saraa04 commented 5 years ago

not (not True or False and True) or False not (False or False and True) or False not (False or False) or False not (False) or False True or False => True

DavideApolloni commented 5 years ago

not (not true or false and true) or false not (false or false and true) or false not (false or false) or false not (false) or false not false or false true or false true

essepuntato commented 5 years ago

Hi all,

Thanks for all the answers! Some comments: it is important, in these cases, to clarify in which order the passages have been executed, in particular for the part not True or False and True. In this case the paggages should be (between "**" the operation that is considered every time):

**not** True or False and True -->
False or False **and** True -->
False **or** False -->
False

While using another way for executing the operation can result in the same final outputs, it is important to use the right order. For instance, the following approach (exchanging the way the boolean operators are commonly considered) is wrong even if the final result is correct:

not True **or** False and True -->
not True **and** True -->
**not** True -->
False