Checkpoint: Python Essentials
You've learned string formatting, string methods, sets, tuples, comprehensions, *args / **kwargs , lambda, enumerate and zip — let's combine them. This checkpoint isn't a new topic; it's where the separate pieces click into a single, working program.
Learn Checkpoint: Python Essentials in our free Python course — a beginner-friendly interactive lesson with runnable examples, a practice exercise and a…
Part of the free Python course at LearnCodingFast — hands-on lessons with examples you run in your browser, plus practice exercises and a quick quiz.
We'll recap each tool, build one realistic report together step by step, then run a short quiz to spot anything worth a second look.
A quick map of the eight tools you're about to combine:
Here's the brief. You're given a list of (name, score) tuples. Build a small program that produces a ranked, formatted scoreboard and a short summary — using as many of this section's tools as naturally fit.
Attempt the build first, then expand this to compare your approach. There's more than one correct answer — focus on whether each tool was used where it fits.
Look at how many tools appear in those few lines: a comprehension filters, a lambda drives the sort, enumerate numbers the rows, tuple unpacking reads each record, an f-string with alignment formats every line, and a set comprehension collects the unique grade bands. This is the everyday shape of real Python data code.
Want to push further? This optional extension folds in *args , zip , and a dict comprehension. Read it, then try modifying it:
Predict each answer, then reveal it. Each one maps back to a specific lesson if you want to review.
Total: $7.00 — the :.2f spec formats the integer as a float with two decimal places. (See: f-strings.)
hi there — the chain trims spaces, lowercases, then swaps the hyphen for a space. (See: String methods.)
{' '} — the & operator returns the intersection, the only element in both sets. (See: Sets.)
30 — tuple unpacking sets x = 10 and y = 20 , so their sum is 30. (See: Tuples.)
[0, 2, 4] — the comprehension keeps only the even numbers from 0–5. (See: Comprehensions.)
1 Ada then 2 Ben — enumerate with start=1 numbers the items from 1. (See: enumerate & zip.)
Checkpoint cleared — these tools are now yours!
You combined f-strings, string methods, sets, tuples, comprehensions, *args / **kwargs , lambda, and enumerate/zip into a single working program. That's exactly how professional Python is written — small, sharp tools composed together.
🚀 Up next: Regular Expressions (re) — a pattern-matching mini-language for finding and extracting anything inside text.
Practice quiz
What does f"Total: {7:.2f}" produce?
- Total: 7
- Total: 7.00
- Total: 7.0
- Total: {7:.2f}
Answer: Total: 7.00. The :.2f format spec renders the number as a float with exactly two decimal places, so 7 becomes 7.00.
What is the result of " Hi-There ".strip().lower()?
- "hi-there"
- "Hi-There"
- " hi-there "
- "hi there"
Answer: "hi-there". strip() removes the surrounding spaces and lower() lowercases the letters; the hyphen is left untouched.
Given a = {1, 2, 3} and b = {3, 4, 5}, what does a & b return?
- {1, 2, 3, 4, 5}
- {1, 2}
- {3}
- {4, 5}
Answer: {3}. The & operator is set intersection, returning only the elements present in both sets — here just 3.
After pair = (10, 20) and x, y = pair, what is x + y?
- (10, 20)
- 1020
- 30
- an error
Answer: 30. Tuple unpacking assigns x = 10 and y = 20, so x + y evaluates to 30.
What does [n for n in range(6) if n % 2 == 0] produce?
The comprehension keeps only the even numbers from 0 through 5, giving [0, 2, 4].
In enumerate(["Ada", "Ben"], start=1), what index does "Ada" get?
- 0
- 1
- 2
- None
Answer: 1. The start=1 argument makes enumerate begin counting at 1, so the first item "Ada" gets index 1.
What does a *args parameter collect inside a function?
- Extra keyword arguments as a dict
- Extra positional arguments as a tuple
- Only the first positional argument
- A single list that must be passed explicitly
Answer: Extra positional arguments as a tuple. *args gathers any extra positional arguments into a tuple; **kwargs is the one that gathers keyword arguments into a dict.
Which call sorts pairs by their second element, highest first?
A lambda key of p[1] sorts by the second element, and reverse=True makes it descending (highest first).
What does zip(["a", "b"], [1, 2]) let you iterate over?
- The pairs ("a", 1) and ("b", 2)
- a
- b
Answer: The pairs ("a", 1) and ("b", 2). zip walks the lists in parallel, yielding tuples that pair items by position: ("a", 1) then ("b", 2).
What kind of object does {grade(s) for n, s in students} create?
- A list
- A tuple
- A set
- A generator
Answer: A set. Curly braces with a single expression (no key:value) build a set comprehension, which keeps only unique values.