Thursday, September 14, 2023 7:05 PM: Python 22 Batch 7 PM Page 1
Thursday, September 14, 2023 7:05 PM: Python 22 Batch 7 PM Page 1
Exponential Operator(**):
2**3
3**2
4**3
output:
>>> 2**3
8
>>> 3**2
9
>>> 4**3
64
>>> 4**4
256
>>>
7.Modulo Operator(%)
9%3
0
>>> 6%2
0
>>> 8%2
0
>>> 6%5
1
>>>
>,>=,<,<=,==
a.AND
b.OR
c.NOT
a.AND
In case of AND the result is true when both values are true , otherwise the result is
false.
T T T
T F F
F T F
F F F
2.OR
In case of OR if itleast one value is True the result is True otherwise the result is
False
T T T
F T T
T F T
F F F
n=21
NOT
If the value is True the result is False, if the value is False the result is True
not True-->False
not False-->True
not True
False
>>> not False
True
>>>
0-->False
43-->True
a-->True
Rule:
In case of AND operator for non boolean values, if x evaluates to False then the result
is x, if x evaluates to True then the result is y
0 and 20
output:
0
10 and 20
20
30 and 0
grapes
apple
Note:
Rule:
Example:
10 or 20
output:
10
-14 or -18
output:
-14
'' or 'grapes'
output:
'grapes'
output:
' ' 0-->False
1 True
10 and 20 any number->
True
Equality Operators
==,!=
10==20-->False
10==20
False
>>> 10!=20
True
>>> 1==True
True
>>> 'orange'=='orange'
True
>>>