Introduction to Python
Python is a high-level, interpreted programming language known for its simplicity and readability. It
is widely used in web development, data science, AI, and automation.
Variables and Data Types
Variables store data values. Common data types include int, float, string, and boolean. Python is
dynamically typed.
Operators
Operators are used to perform operations on variables. Types include arithmetic, relational, logical,
bitwise, and assignment operators.
Control Statements
Control statements like if, else, elif are used for decision making. They control the flow of execution
in a program.
Loops
Loops like for and while are used to repeat a block of code. Break and continue control loop
execution.
Functions
Functions are reusable blocks of code defined using def keyword. They can take parameters and
return values.
Lists, Tuples, Sets, Dictionary
Python provides built-in data structures: lists (mutable), tuples (immutable), sets (unique values),
dictionaries (key-value pairs).
File Handling
Python allows reading and writing files using open(), read(), write(), and close(). Modes include r, w,
a.
Exception Handling
Errors are handled using try, except, finally blocks. It prevents program crash and ensures smooth
execution.
Object Oriented Programming
OOP concepts include class, object, inheritance, encapsulation, and polymorphism. It helps in code
reusability.