not→ used to get the opposite value
| Input | Output |
|---|---|
| True | False |
| False | True |
and→ returnsTrueonly if both values areTrue
| Input 1 | Input 2 | Output |
|---|---|---|
| True | True | True |
| False | True | False |
| True | False | False |
| False | False | False |
or→ returnsTrueif at least one value isTrue
| Input 1 | Input 2 | Output |
|---|---|---|
| True | True | True |
| False | True | True |
| True | False | True |
| False | False | False |
example
a = True
b = False
print(not a)
print(a and b)
print(a or b)output
False
False
True<< Python Assignment Operators | Python Operator Precedence >>