· 3 min read

Python Built-in Functions Study Guide: 77 Flashcards from abs to zip

Memorize Python's built-in functions with 77 flashcards: all, divmod, iter, chr, compile, int bases, hash. Study them in families and fix the classic traps.

Blue and yellow python snake coiled around a glowing toolbox among floating flashcards

Studying. But it's also a video game. 🎮

Flashcards, quizzes and games that make you actually remember.

Start playing — it's free

Posted by

Python ships with a short list of functions you can call without importing anything, and knowing them cold is the difference between writing ten lines and writing one. Deck BX4173 – Python: Built-in Functions turns that list into 77 cards: one per function, plus a dozen gotcha cards on edge cases.

Study this deck: Python: Built-in Functions

1 / 10
Question

Abs()

Knew itLearning

Tap the card for the answer · swipe right if you knew it, left if not

Sample cards

FrontBack
All()True if all elements of the iterable are true (or if the iterable is empty)
Divmod()A pair of numbers consisting of quotient and remainder when using integer division (a // b, a % b)
2-argument form of iter()iter(callable, sentinel) - calls callable until it returns sentinel, then raises StopIteration
Valid range for chr()0 through 1,114,111 (0x10FFFF in base 16)
Three modes for compile()'exec' (statements), 'eval' (single expression), 'single' (single interactive statement)
Is bool a subclass of int?Yes, bool is a subclass of int. Its only instances are True and False
Can hash values for equal numbers differ?No - numeric values that compare equal have the same hash value (e.g., 1 and 1.0)
What bases are allowed for int() conversion?0 and 2-36 (base 0 interprets like code literals: 0b, 0o, 0x prefixes)

What you'll memorize

Numbers: abs, divmod, pow, round, sum, min, max, bin, oct, hex, int, float, complex. Iteration: iter, next, enumerate, zip, map, filter, reversed, sorted, range, len, any, all. Types and containers: bool, str, list, tuple, dict, set, frozenset, bytes, bytearray. Introspection: type, isinstance, issubclass, callable, id, hash, dir, vars, globals, locals, getattr, setattr, hasattr, delattr, help. Code execution: eval, exec, compile, breakpoint. Strings and I/O: chr, ord, ascii, repr, format, print, input, open. Classes: super, @classmethod, @staticmethod, @property.

Fix the casing first

Every front is capitalized (Abs(), Len(), Zip()). Python is case-sensitive, and Abs(-3) raises a NameError. Retype the fronts in lowercase before your first session, or your muscle memory will learn the wrong spelling.

Study in families, not alphabetically

The deck runs A to Z, which scatters functions that only make sense together. Review them as sets:

  • Inverses: chr/ord, getattr/setattr/hasattr/delattr, bin/oct/hex vs int(s, base).
  • Lazy, single-use iterators: map, filter, zip, reversed, enumerate return iterators you can consume once; sorted returns a new list. Pair this with card 77: zip and map stop at the shortest iterable, and since Python 3.10 zip(..., strict=True) raises a ValueError instead.
  • Empty-iterable traps: all([]) is True, any([]) is False.
  • eval / exec / compile: one evaluates an expression, one runs statements and returns None, one builds the code object both can use. Never feed them user input (card 71).

Add the missing cards

Write one more card for round(), whose card doesn't mention banker's rounding: round(2.5) == 2 and round(0.5) == 0, because halves round to the nearest even number. The deck also skips a few built-ins from the official table: aiter(), anext(), memoryview(), object(), slice() and __import__(). Add them if you're preparing for an interview or a certification.

The three decorators here (classmethod, staticmethod, property) get their full treatment in Advanced Python: decorators, descriptors, lambdas and exceptions, and the containers in Python data structures and comprehensions.

Open BX4173 – Python: Built-in Functions in the library on Flip It.

Ready to learn faster? 🚀

Join FLIP IT for free and turn studying into a game.

Create my free account