@@ -112,16 +112,16 @@ in Python. It's **unary**, which means that it takes only one **operand**.
112
112
The operand can be a Boolean expression or any Python object. The task of
113
113
``not`` is to reverse the truth value of its operand.
114
114
115
- .. table:: not operator
115
+ .. table:: not operator truth table
116
116
:align: center
117
117
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
+ +-------------+---- -------------+
125
125
126
126
This functionality makes it worthwhile in several situations:
127
127
@@ -132,6 +132,31 @@ This functionality makes it worthwhile in several situations:
132
132
- Checking if a **value is not in a given container**
133
133
- Checking for an **object's identity**
134
134
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
+
135
160
Comparison
136
161
==========
137
162
0 commit comments