1
621views
Explain the arithmetic and logical operators in python.
1 Answer
| written 3.6 years ago by |
Arithmetic Operators in Python :-
| Operator | Name | Example |
|---|---|---|
| + | Addition | a + b |
| - | Subtraction | a - b |
| * | Multiplication | a * b |
| / | Division | a / b |
| % | Modulus | a % b |
| ** | Exponentiation | a ** b |
| // | Floor Division | a // b |
Logical Operators in Python :-
| Operator | Description | Example |
|---|---|---|
| and | Returns True if both statements are true | x < 5 and x < 10 |
| or | Returns True if one of the statements is true | x < 5 or x < 4 |
| not | Reverse the result, returns False if the result is true | not(x < 5 and x < 10) |