Basic Python Interview Questions
Basic Python Interview Questions
Q: What is Python?
A: Easy to learn and use, Interpreted language, Dynamically typed, Extensive standard libraries,
A: Python is dynamically typed, concise, and has simpler syntax compared to statically typed
A: Python is an interpreted language. Code is executed line by line using the Python interpreter.
A: int, float, complex, str, bool, list, tuple, set, dict, NoneType.
Q: What is PEP 8?
A: PEP 8 is Pythons style guide it recommends best practices for writing clean and readable code.
A: List: Ordered, mutable, duplicates; Tuple: Ordered, immutable, duplicates; Set: Unordered,
A: Mutable: Can be changed (e.g., list, dict); Immutable: Cannot be changed (e.g., int, str, tuple).
A: break: Exits loop; continue: Skips current iteration; pass: Does nothing (placeholder).
Q: Function vs Method?
Q: What is recursion?
Q: What is inheritance?
Q: Built-in exceptions?
Q: What is a module/package?
Q: What is a decorator?
Q: What is a generator?
Q: Python 2 vs Python 3?
A: Python 3 has better Unicode support, different print syntax, integer division, and is the current
standard.