What is the difference between a list and a tuple?
Lists are mutable (can be changed), tuples are immutable. Lists use [], tuples use (). Tuples are faster and can be used as dictionary keys.
What is PEP 8?
PEP 8 is Python's style guide. It recommends 4-space indentation, 79-character line limits, snake_case for functions/variables, and CamelCase for classes.
What is the difference between deepcopy and shallow copy?
Shallow copy creates a new object but inserts references to the original nested objects. Deep copy recursively copies all nested objects.
How does Python handle memory?
Python uses automatic memory management with reference counting and a generational garbage collector for cyclic references.
Top 20 Interview Questions
Explain the Python execution model (bytecode, interpreter, GIL).
What are decorators and how do they work?
Explain the difference between is and ==.
How does inheritance and MRO work in Python?
What are generators and when should you use them?
Explain list comprehensions vs generator expressions.
What is the difference between staticmethod, classmethod, and instance methods?
How do you handle exceptions in Python?
What is the with statement and how does it work?
Explain the GIL and its impact on multithreading.
What are *args and **kwargs?
How do you manage packages in Python?
What are context managers?
Explain the difference between mutable and immutable types.
How does Python's garbage collection work?
What is the difference between __str__ and __repr__?
Test your knowledge with these platforms: HackerRank Python challenges, LeetCode Python problems, CodeWars katas, and the official Python tutorial quiz at docs.python.org.
Tip: Build a portfolio of 3-4 complete projects. Contribute to open source. Practice coding challenges regularly.
Final Exercise: Build a complete command-line application that reads a CSV file, processes data using Pandas, generates plots with Matplotlib, and exports a summary report as JSON. Include argument parsing, error handling, logging, and type hints.