Review

Retrieve the path from named readings through numerical calculation to a labelled text report, then recall how line reading and type inspection explain surprising behavior.

Names and Current Values

An assignment first evaluates its right side, then makes the name on the left refer to the result. In a reassignment such as

count = count + 1

the count on the right supplies the old value. The assignment then updates what count refers to.

Readable names state the role of a value. reading_count communicates more than x, even though both are valid names.

Calculation and Evaluation Order

Integers represent whole numbers. Floating-point values represent numbers such as 20.5. The report uses ordinary arithmetic to calculate its total and mean:

Parentheses make an intended order visible. Floor division // counts complete groups, % finds a remainder, and ** raises a value to a power. A hand calculation or reconstruction such as groups * size + remainder provides a small independent check.

Numbers and Report Text

Quotation marks create strings. 4 is an integer, while "4" is text. An f-string places values inside labelled text without changing the numerical values:

print(f"Mean: {mean:.1f} {unit}")

The formatting instruction .1f controls the displayed decimal places. It does not replace mean.

Read a Line from the Inside Out

In mean = total / count, the names supply operands, / is the operator, and total / count is the value-producing expression. The complete assignment is a statement.

In print(f"Mean: {mean:.1f} {unit}"), Python builds the f-string first. That string becomes the argument to the print() function call, which displays it.

Inspect Before You Repair

type() reports evidence about a value. It does not repair it. If an operation behaves unexpectedly, inspect its operands and trace the assignments that supplied them.

Use int(), float(), or str() only when the source value genuinely represents the new kind of value. For example, int("4") is reasonable when the text means a count; int("four") cannot produce an integer.

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.