Comprehensive Python CheatSheet 1731972192
Comprehensive Python CheatSheet 1731972192
1. Basic Operations
● Addition: result = 5 + 3
● Subtraction: result = 10 - 4
● Multiplication: result = 6 * 7
● Division: result = 15 / 3
● Integer division: result = 17 // 3
● Modulus: remainder = 17 % 3
● Exponentiation: result = 2 ** 3
● Absolute value: abs(-5)
● Round number: round(3.7)
● Round to specific decimal places: round(3.14159, 2)
● Floor division: import math; math.floor(5.7)
● Ceiling division: import math; math.ceil(5.2)
● Square root: import math; math.sqrt(16)
● Calculate pi: import math; math.pi
● Calculate e: import math; math.e
● Logarithm (base e): import math; math.log(10)
● Logarithm (base 10): import math; math.log10(100)
● Sine: import math; math.sin(math.pi/2)
3. Strings
5. Tuples
6. Sets
7. Dictionaries
8. Control Flow
9. Functions