Python Study Guide 2026
Everything you need to pass the Python exam in one place: the exam format, every topic to study, real practice questions with explanations, flashcards, and full-length practice tests. Free, no sign-up needed.
📋 Python Exam Format at a Glance
📚 Python Topics to Study (21)
✍️ Sample Python Questions & Answers
1. Which of the following scenarios best demonstrates the concept of polymorphism in Python?
Polymorphism (from Greek, meaning "many forms") is the ability of an object to take on many forms. In programming, it means that a single interface (like the `render_shape` function) can be used for objects of different types. The function can operate on different shape objects without needing to know their specific type, as long as they adhere to the common interface of having a `.draw()` method.
2. What does the following code output? print(bool(0), bool(3.14159), bool(-3), bool(1.0+1j))
The `bool()` function converts a value to its boolean equivalent. In Python, zero (0), empty sequences/collections, and `None` are considered "falsy". All other numbers (including non-zero integers, floats, and complex numbers) are considered "truthy". Therefore, `bool(0)` is `False`, while `bool(3.14159)`, `bool(-3)`, and `bool(1.0+1j)` are all `True`.
3. What does the format string `'{0} {1}'.format('Hello', 'World')` produce?
Positional placeholders {0} and {1} are replaced with the first and second format arguments.
4. What is a 'free variable' in the context of Python closures?
A free variable is a variable referenced inside a function but not defined in that function's local scope — it is bound in an enclosing scope and captured by the closure.
5. What is the result of `[str(x) for x in range(3)]`?
str() converts each integer to its string representation, producing ['0', '1', '2'].
6. What is a closure in Python?
A closure is an inner function that remembers the values from its enclosing scope even when execution has moved outside that scope.