Python Interview-Focused Notes
1. Python Basics (Most Asked)
• Python is interpreted, dynamically typed, and object-oriented.
• PEP 8 – Python coding style guidelines.
• Python uses indentation instead of braces.
2. Data Types & Mutability
• Mutable: list, dict, set
• Immutable: int, float, string, tuple
• Strings are immutable – operations create new objects.
3. List vs Tuple
• List is mutable, Tuple is immutable.
• Tuple is faster and memory efficient.
• Tuples can be used as dictionary keys.
4. Shallow Copy vs Deep Copy
• Shallow copy copies references.
• Deep copy copies all nested objects.
• Use copy module for deep copy.
5. Functions & Lambda
• Functions defined using def keyword.
• Lambda functions are anonymous single-line functions.
• Arguments: positional, keyword, default, *args, **kwargs.
6. OOP Concepts
• Class, Object, Inheritance, Polymorphism, Encapsulation, Abstraction.
• __init__ is constructor method.
• self refers to current object.
7. Exception Handling
• Use try-except block.
• finally always executes.
• Custom exceptions can be created.
8. Memory Management
• Python uses automatic garbage collection.
• Reference counting is primary mechanism.
• gc module manages garbage collection.
9. Multithreading vs Multiprocessing
• GIL allows only one thread to execute Python bytecode.
• Multithreading used for I/O bound tasks.
• Multiprocessing used for CPU bound tasks.
10. Important Built-in Functions
• map(), filter(), reduce()
• zip(), enumerate()
• any(), all(), sorted()
11. File Handling
• Modes: r, w, a, rb, wb
• Use with statement to auto-close files.
12. Common Interview Questions
• Difference between == and is
• What is GIL?
• Explain decorators
• Explain generators and yield
Prepared for quick Python interview revision.