Review

Reconstruct the path from ordered selection through collected and transformed values to checked summaries and predictable display order.

From an Ordered Source to One Selection

Lists, tuples, and strings preserve an order. An index selects one item; a slice selects a range and preserves the sequence type.

The start boundary is included and the stop boundary is excluded. A single invalid index raises IndexError; an ordinary slice may stop at the sequence boundary without failing.

From an Empty List to Collected Results

append changes an existing list and returns None:

The result is [18, 20]. Do not assign available.append(reading) back to available. Strings behave differently: strip, lower, and other string methods return new strings rather than changing the source text.

The text path stays visible:

"  Mean Temperature  "
→ "Mean Temperature"
→ "mean temperature"
→ ["mean", "temperature"]
→ "mean-temperature"

From Separate Sequences to Aligned Pairs

A tuple keeps a small fixed group together, and unpacking names its positions. enumerate(readings) pairs each value with a position. zip(labels, readings) pairs two sequences and stops when the shorter one ends. Check equal lengths first when silently losing an unmatched value would be wrong.

From Visible Loops to Standard Summaries

Use sum, min, max, any, and all only after the loop they replace is understood. Their empty-input behavior is part of the operation:

ExpressionEmpty result
sum([])0
any([])False
all([])True
min([]) or max([])raises ValueError

If empty data has domain meaning, check it separately rather than relying only on the built-in result.

From a Building Loop to a Comprehension

These forms build the same corrected list:

Read a comprehension from its for clause. Apply an optional filter before the result expression. Expand a nested or unclear form back into loops.

When the program needs only a summary, the same readable expression may appear inside sum, any, or all without list brackets:

total = sum(reading + 0.5 for reading in readings)

Build a named list instead when intermediate values deserve inspection.

From Arrival Order to Predictable Display

sorted(values) returns a new list and preserves the source. values.sort() changes the list and returns None. A named key function makes a comparison rule visible. Returning (reading, label) orders by reading first and uses the label to break ties.

The complete path is:

ordered source → selection → collected result → text parts → aligned pairs
               → summary → transformed values → predictable order

Pause and reflect

What can you now explain without looking back, and what should you revisit? The note stays with this review.

Review

Not marked done.