Booleans can also be manipulated using the
Boolean operators and
, or
and not
.
Let's see that in action:
a = False b = True print(a and b) print(a or b) print(not a and b)
The code above will print
False
True
True
In a nutshell, boolean operations follow the logic below:
a and b
: if a
is False
, return a
, else return b
a or b
: if a
is True
, return a
, else return b
not a
: if a
is True
, return False
else return True
Create two variables validated
and processed
and set them
to True
and False
.
Then, create another variable called completed
and set it to the result of the and
operation on validated
and processed
.