1. Arithmetic Operators
Arithmetic operators are used to perform basic mathematical operations on numeric data types.
2. Comparison Operators
Comparison operators are used to compare two values and return a Boolean value (True or False) as a result.
3. Assignment Operators
Assignment operators are used to assign values to variables.
4. Bitwise Operators
Bitwise operators are operators used when expressing integers as binary bits. Each operator operates on a bit-by-bit basis of an integer.
- & : Bitwise AND
- | : Bitwise OR
- ^ : Bitwise XOR
- ~ : Bitwise NOT
- << : Left shift
- >> : Right shift
5. Logical Operators
Logical operators are primarily used to manipulate Boolean values in Python. However, unlike other languages, Python's logical operators do not always return True or False as the result of an operation. Instead, they return the value of the last evaluated operand.
- AND (&) : Returns True only if both operands are True.
- OR (|) : Returns True if either operand is True.
- NOT (~) : Returns the logical negation of the operand.
'Python(Eng. ver)' 카테고리의 다른 글
10. Loop Statement in Python (0) | 2024.03.14 |
---|---|
9. Conditional Statements in Python (0) | 2024.03.14 |
7. Python collection type - Dictionary (0) | 2024.03.14 |
6. Python collection type - Set (0) | 2024.03.14 |
5. Python collection type - Tuple (0) | 2024.03.14 |