Memorize Python Data Structures and Comprehensions: 125 Flashcards on Lists, Dicts, Sets and Generators
Learn Python lists, tuples, sets, dicts, comprehensions and generators with 125 real flashcards from deck JL4402 on Flip It, plus a 3-round study plan and Python-specific tips.

Studying. But it's also a video game. 🎮
Flashcards, quizzes and games that make you actually remember.
Posted by
Related reading
Learn Python OOP in German: 59 Flashcards on Klassen, Vererbung and Magische Methoden
Study Python OOP with German explanations: 59 real flashcards on Klassen, Vererbung, MRO, Kapselung and dunder methods, plus 4 cards to fix and überschreiben vs überladen.
Master Python OOP in Spanish: 59 Flashcards on Clases, Herencia and Métodos Mágicos
Learn Python object-oriented programming with Spanish explanations: 59 real flashcards on clases, herencia, MRO, métodos mágicos and the Spanish terms to know.
Learn Python OOP in French: 59 Flashcards on Classes, Héritage and Méthodes Magiques
Study Python object-oriented programming in French with deck EO1367: 59 flashcards on classes, self, super(), MRO, dunder methods, @property and metaclasses.
Confident Python developers know, without looking it up, when a tuple beats a list, why {} is not an empty set, and how a generator expression differs from a list comprehension. Deck JL4402 — Python: Data Structures & Comprehensions on Flip It packs exactly that into 125 flashcards based on the official Python tutorial. Here is how to memorize them.
Study this deck: Python: Data Structures & Comprehensions
1 / 10List.append(x)
Tap the card for the answer · swipe right if you knew it, left if not
What the 125 cards cover
The deck moves through five blocks, in roughly this order:
- List methods —
append,extend,insert,remove,pop,clear,index,count,sort,reverse,copy, plus lists as stacks and whycollections.dequebeats a list as a queue. - Tuples and sets — immutability, the one-item tuple
('hello',), packing/unpacking,set()vs{}, set differencea - b, set comprehensions. - Dictionaries — immutable keys only,
d[key]vsd.get(key),KeyError,dict.items(), insertion order since 3.7,dict(zip(keys, values)), duplicate keys in comprehensions (last value wins). - Looping and comparison —
enumerate,zip,reversed,sorted,sorted(set(seq)),in/not in,isvs==, chained comparisons, short-circuitand/or, the walrus operator:=, lexicographical sequence ordering. - Comprehensions and generators — nested comprehensions, matrix transposition, flattening,
yield,next(),StopIteration,send(),close(),throw(),yield from, recursive generators, lazy evaluation,any()/all()/sum()/max()over generators.
Sample flashcards from the deck
| Front | Back |
|---|---|
| Create a tuple with one item | Follow the value with a comma: ('hello',) — parentheses alone are not sufficient |
| Create an empty set | Use set() — not {}, which creates an empty dictionary |
del a[i] vs a.pop(i) | del removes the item; pop removes and returns it |
sorted() vs list.sort() | sorted() returns a new sorted list; list.sort() sorts in place and returns None |
| Preferred way to transpose a matrix | list(zip(*matrix)) — built-in functions over complex comprehensions |
| Syntax for flattening a nested list | [num for elem in nested_list for num in elem] |
| What exception does a generator raise when exhausted? | StopIteration, raised by __next__() when there are no more elements |
| Can you reset a generator to the beginning? | No. Generators only go forward; call the generator function again to restart |
() vs [] for comprehensions | () creates a lazy generator, [] creates a list with all values in memory |
| Can you use the walrus operator in comprehensions? | Yes (Python 3.8+): [y for x in data if (y := f(x)) > 0] |
A three-round plan for 125 cards
Round 1 — the mutability map (lists, tuples, sets, dicts). Tag every card mutable or immutable. That one distinction explains why tuples can be dict keys and lists cannot, why list.sort() returns None, and why del a[:] equals a.clear().
Round 2 — the loop idioms. Drill the enumerate, zip, reversed, sorted and items() cards until for k, v in d.items(): comes out automatically — these are the cards interviewers test.
Round 3 — comprehensions and generators. Keep a REPL open. When a card gives [x**2 for x in range(10)], type it, then the generator version (x**2 for x in range(10)) and call next() on it. Seeing <generator object> once is worth ten reviews.
Two Python-specific tips
- Read the brackets first. For every comprehension card, before reading the expression, name the delimiter:
[]list,{}set or dict (dict if there is a colon),()generator. The deck deliberately contrasts[x, y for x in range(3)](SyntaxError) with[(x, y) for x in range(3)]— that one card catches a bug you will otherwise ship. - Group the "returns None" cards.
append,insert,remove,sort,reverse,clear,extendall returnNonebecause they mutate in place. Learn them as one family andx = my_list.sort()will never bite you again.
Start reviewing
Log in to Flip It and search the library for deck code JL4402 (Python: Data Structures & Comprehensions). Spaced repetition schedules the 125 cards for you; about two weeks of ten-minute sessions gets them to stable recall.
Working through the other backend languages? Try the Java core concepts and OOP study guide or the Go essentials guide.
Ready to learn faster? 🚀
Join FLIP IT for free and turn studying into a game.