Python Python Notes 1. Introduction to Python Python is an interpreted, high-level programming language with dynamic typing. It supports multiple programming paradigms, including procedural, object-oriented, and functional programming. Python uses indentation instead of brackets blocks. {} to define code 2. Data Types Numeric: Includes integers, floating-point numbers, and complex numbers. Text: Represented by strings ( str ). Boolean: Represents True or False . Sequence: Includes lists, tuples, and ranges. Set: Stores unique values and is unordered. Mapping: Dictionaries store key-value pairs. 3. Operators Arithmetic: Used for mathematical calculations. Comparison: Compares values and returns a Boolean. Logical: Includes and , or , and not operators. Assignment: Assigns values to variables. Membership: Checks if a value exists within a sequence. Identity: Compares memory locations of objects. Python 1 4. Control Flow Conditional Statements: if , elif , and decision-making in a program. else statements control Loops: for loops iterate over a sequence. while loops continue execution as long as a condition is true. Loop Control Statements: break exits a loop prematurely. continue pass skips the current iteration. acts as a placeholder in empty loops or functions. 5. Functions Functions allow code reusability and modular programming. They can take parameters and return values. Default arguments provide predefined values if no arguments are passed. Lambda functions are small anonymous functions used for quick operations. 6. Data Structures Lists: Mutable and ordered sequences used to store multiple values. Tuples: Immutable sequences, meaning their values cannot be changed. Dictionaries: Unordered collections that store key-value pairs. Sets: Unordered collections of unique elements. 7. Object-Oriented Programming (OOP) Python 2 Classes & Objects: Python follows an OOP approach where realworld entities are represented as objects. Inheritance: Allows a class to inherit attributes and methods from another class. Encapsulation: Restricts direct access to some components of an object. Polymorphism: Allows different classes to be used interchangeably. 8. File Handling Files can be opened, read, written, and closed using built-in Python functions. The with statement ensures proper handling of file operations. 9. Modules & Libraries Python has built-in and third-party modules that extend its functionality. Custom modules can be created and imported into other scripts. 10. Exception Handling Used to manage errors that occur during execution. try and finally except blocks catch and handle exceptions. ensures code execution regardless of exceptions. 11. Advanced Python Concepts List Comprehensions: Provide a concise way to create lists. Decorators: Modify functions without changing their structure. Multithreading: Allows concurrent execution of multiple tasks. Python 3