Related Interview Questions
Additional questions for comprehensive preparation
Using:
text.capitalize()
Example:
"praful kumar".capitalize()
Generators are special iterators created using yield.
They produce values one at a time, saving memory.
Example:
Generators are lazy, fast, and memory-efficient.
Single-line comment
Multi-line comment (docstring style)
"""
Block comment
"""
GIL is a lock in CPython that allows only one thread to execute Python bytecode at a time.
Effects:
- Prevents true parallel execution of threads
- Python threads are ideal for I/O-bound tasks
- Not ideal for CPU-bound tasks
(Use multiprocessing for parallel CPU work.)
Django
- Full-featured framework
- Built-in authentication, ORM, admin panel
- Great for large, structured applications
Flask
- Lightweight and flexible
- Choose your own components
- Perfect for microservices, APIs, prototypes
Which is better?
Depends on your project:
- Large enterprise project → Django
- Small service, API, or custom architecture → Flask
Flask is a lightweight, micro web framework.
Benefits
- Minimal and flexible
- Easy to learn
- Extensible with many plugins
- Perfect for APIs and microservices
- Less overhead, fast development
Example minimal app:
from flask import Flask
app = Flask(__name__)
@app.route("/")
PIP is Python’s package manager.
Used to install, upgrade, and uninstall packages.
Examples:
pip install django
pip install flask
pip uninstall numpy
pip list
It connects to the Python Package Index (PyPI).
