Python Flashcards
7 cards from real Python practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 Python flashcards as text
What does the `*args` syntax in a function definition allow?
Answer: Accept any number of positional arguments
`*args` collects extra positional arguments into a tuple inside the function.
Which method removes and returns the last element of a Python list?
Answer: pop()
`list.pop()` removes and returns the last element by default, or an element at a given index.
What is the output of `bool([])` in Python?
Answer: False
An empty list is falsy in Python, so `bool([])` returns `False`.
Which keyword is used to define a generator function in Python?
Answer: yield
Using `yield` instead of `return` makes a function a generator that produces values lazily.
What does the `is` operator check in Python?
Answer: Object identity
`is` checks whether two variables refer to the exact same object in memory, not just equal values.
What will `list(range(1, 10, 3))` produce?
Answer: [1, 4, 7]
`range(1, 10, 3)` starts at 1, steps by 3, and stops before 10: 1, 4, 7.
Which of the following is a mutable data type in Python?
Answer: list
Lists are mutable — their elements can be changed after creation, unlike tuples, strings, and frozensets.
Written and edited by Nathan Beja, founder of Practice Test Geeks, with AI assistance. We have not yet matched this exam's facts to an official source, so confirm fees, dates and rules with the exam body. Editorial policy