Skip to content
This repository was archived by the owner on Jul 2, 2024. It is now read-only.

Commit 7ed9b43

Browse files
committed
Added 'logical conjunction' (and) description
Signed-off-by: Serhii Horodilov <sgorodil@gmail.com>
1 parent e8d8c4c commit 7ed9b43

File tree

1 file changed

+33
-8
lines changed

1 file changed

+33
-8
lines changed

src/basics/bool_logic.txt

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,16 @@ in Python. It's **unary**, which means that it takes only one **operand**.
112112
The operand can be a Boolean expression or any Python object. The task of
113113
``not`` is to reverse the truth value of its operand.
114114

115-
.. table:: not operator
115+
.. table:: not operator truth table
116116
:align: center
117117

118-
+-----------+-------------+
119-
| operand | not operand |
120-
+===========+=============+
121-
| ``True`` | ``False`` |
122-
+-----------+-------------+
123-
| ``False`` | ``True`` |
124-
+-----------+-------------+
118+
+-------------+-----------------+
119+
| ``operand`` | ``not operand`` |
120+
+=============+=================+
121+
| ``True`` | ``False`` |
122+
+-------------+-----------------+
123+
| ``False`` | ``True`` |
124+
+-------------+-----------------+
125125

126126
This functionality makes it worthwhile in several situations:
127127

@@ -132,6 +132,31 @@ This functionality makes it worthwhile in several situations:
132132
- Checking if a **value is not in a given container**
133133
- Checking for an **object's identity**
134134

135+
Getting started with ``and`` operator
136+
-------------------------------------
137+
138+
Python's ``and`` operator is **binary**, which means it takes two **operands**.
139+
The operands in an ``and`` expression are commonly known as *conditions*.
140+
The result of the operator depends on the truth values of its operands. It'll
141+
be ``True`` if **both** are true.
142+
143+
.. table:: and operator truth table
144+
:align: center
145+
146+
+---------------+---------------+-----------------------------+
147+
| ``operand_1`` | ``operand_2`` | ``operand_1 and operand_2`` |
148+
+===============+===============+=============================+
149+
| ``True`` | ``True`` | ``True`` |
150+
+---------------+---------------+-----------------------------+
151+
| ``False`` | ``False`` | ``False`` |
152+
+---------------+---------------+-----------------------------+
153+
| ``True`` | ``False`` | ``False`` |
154+
+---------------+---------------+-----------------------------+
155+
| ``False`` | ``True`` | ``False`` |
156+
+---------------+---------------+-----------------------------+
157+
158+
.. todo: func_1() and func_2(); 0 and 5
159+
135160
Comparison
136161
==========
137162

0 commit comments

Comments
 (0)