1. Datatypes in Python: None Numeric float -> 1.5 int -> 5 complex -> 2+5j bool -> True/false Sequence List -> [3,5,6,7,1] Tuple -> (3,5,6,7,1) Set -> {3,5,6,7,1} String -> "Akshay" Range range(5) -> range(0, 5) list(range(5)) -> [0,1,2,3,4] list(range(2,10,2)) -> [2,4,6,8] Dictonary product_price = {'book': 50, 'pen': 300, 'eraser': 10} product_price.get('book') -> 50 2. Number Conversion in Python bin( 28 ) -> 0b 11100 oct( 28 ) -> 0o 34 hex( 28 ) -> 0x 1c 3. Swap two numbers in Python a = 5 b = 6 Method #1: a, b = b, a Method #2 a = a + b b = a - b a = a - b 4. "math" module in python import math math.sqrt(25) -> 5.0 math.floor(2.5) -> 2.0 math.ceil(2.5) -> 3.0 math.pow(2, 3) -> 8.0 math.pi -> 3.141592653589793 math.e -> 2.718281828459045 5. How to import a module in python import math import math as

## Comments

## Post a Comment