CP1 / COURSE HOME

Week 01 / Describe and decide

Describe a wheel’s travel

Give one physical quantity a name, a value and a unit.

We begin with one calculation. Over the semester, we will build toward a sensor report that another person can understand and check. The small systems along the way give us different parts of that job.

A robot wheel is 65 mm in diameter. It turns ten times. Before asking Python for a distance, we need to decide what these numbers describe.

Start with the problem

Try this first.

Sketch one wheel rotation. Would ten rotations move the robot closer to 2 metres or 20 metres? Explain your estimate without writing code.

Why this week's tool?

Variables keep the diameter and rotation count separate. Arithmetic turns them into ideal travel; a printed unit tells a reader what the result means.

By the end: Explain how you obtained the distance, where the millimetre-to-metre conversion happens, and why wheel slip could change the actual travel.

The idea behind the program

Give every number a physical meaning

A variable stores a value; its name and surrounding description tell us what that value represents. Keep a count, a measured diameter and a calculated distance separate. A rotation count is dimensionless. Diameter has a length unit. Multiplying rotations by circumference gives a length.

Build the model before the program

For an ideal wheel rolling without slip, distance = rotations × π × diameter. Convert the diameter to metres before using the formula. This is a model with an assumption, not a promise about a real robot: slip, deformation and an inaccurate diameter can all change the actual travel.

Precision needs evidence

Displaying six decimals does not improve a ruler measurement. Retain the calculated value internally, then choose a display that makes sense for the input precision. A successful Python run shows that the expression can execute; an independent unit check tells you something different.

A short Python example

Read the example alongside the explanation. Run it in a new notebook cell and change one input to see how it behaves.

rotations = 10
diameter_mm = 65.0
diameter_m = diameter_mm / 1000
distance_m = rotations * 3.141592653589793 * diameter_m
print('Ideal travel (m):', distance_m)

Example output

Ideal travel (m): 2.0420352248333655

Assignment describes a change of state

A Python name refers to a value. Assignment evaluates the right-hand expression using the current state, then binds the name on the left to the result. It is an instruction in time, not an algebraic equality.

Draw or trace

Draw a before-and-after table for distance = 2, step = 3, then distance = distance + step. Keep the printed output in a separate column.

Predict before running. After that update, what happens if step is assigned 10? Does distance automatically become 12?

Trace and explanation — after your prediction
  1. Before the update: distance refers to 2 and step to 3.
  2. Evaluate the right side: 2 + 3 gives 5; assign that result to distance.
  3. Assigning 10 to step later does not rerun the earlier expression. distance remains 5.

The result is 5. A stored number is not a live spreadsheet formula. Recalculate explicitly when the inputs change.

Change one thing. Change the update to distance = step + step. Explain which old value is now irrelevant before running it.

Türkçe: Atama önce sağ tarafı hesaplar, sonra adı sonuca bağlar. Girdi değişince önceki ifade kendiliğinden yeniden hesaplanmaz.

Examples and variations

Each example changes something about the same problem. Open the ones you want to explore and follow the worked explanation.

01Nominal wheel

10 rotations; diameter 65 mm; no slip

Question: About 0.2 m, 2 m or 20 m?

  1. 65 / 1000 = 0.065 m
  2. Circumference ≈ 0.2042 m
  3. 10 × 0.2042 ≈ 2.042 m

Ideal travel ≈ 2.042 m

The unit conversion and the order-of-magnitude estimate agree. This still does not measure actual travel.

02Unit fault

10 rotations; the value 65 is incorrectly treated as metres

Question: By what factor will the estimate change?

  1. Model receives diameter_m = 65
  2. 10 × π × 65 ≈ 2042.035
  3. Compare 2042.035 / 2.042 ≈ 1000

Estimate is 1000 times too large

The code can be syntactically perfect while describing the wrong physical system. Record units at the input boundary.

03Diameter uncertainty

10 rotations; diameter could be 64–66 mm

Question: What range of ideal travel is consistent with that interval?

  1. Lower: 10 × π × 0.064 ≈ 2.011 m
  2. Upper: 10 × π × 0.066 ≈ 2.073 m
  3. Neither endpoint includes possible slip

Ideal travel ≈ 2.011–2.073 m

A range communicates more than extra decimal places. The interval only captures the stated diameter uncertainty.

See the Colab code run

Interactive walkthroughs of Colab Setup, Variables & Data Types. Enable JavaScript to step through code, variables, collections and output. The companion notebook remains available below.

Work on it in Colab

Use the notebook to try the ideas yourself. The steps below connect this week's example to the programming practice.

  1. Sketch the wheel and label the diameter, one rotation and the output unit. Estimate the answer before using the supplied model.
  2. Run the nominal model in a fresh notebook cell. Change only the diameter to 64 mm, then 66 mm. Record what changed and what stayed fixed.
  3. Use a paper circle or a round object rolled once along paper, if available. Compare the traced travel with π × diameter; otherwise use the provided diameter interval. Name one reason for disagreement.
  4. Deliberately remove the /1000 conversion. Explain why the result still runs and why you reject it.

Something to take away: A labelled sketch, a three-row diameter/travel table, and a two-sentence claim separating ideal travel from measured travel.

Suggested exercises, downloads & solutions

Read the notebook's teaching cells before these exercises.

  • EX02 Rectangle Calculator (Easy)
  • EX04 Speed Calculator (Easy)
  • EX08 Circle Properties (Medium)
Download notebookWorked solutions

Use the notebook's core and optional labels to choose your workload. This activity fits within guided class time.

Optional notes & guidance
My notes
Using AI or working with a partner

Ask AI to write a wheel-distance calculator. Before accepting it, inspect the input units, find the conversion, and test the 1000-fold unit fault. Request an explanation of the no-slip assumption; verify that the formula actually uses it.

You can also review the supplied example with a partner. Use the same inputs to compare the reasoning. Follow the syllabus rules for assessed work.