Skip to content
Exit presentation

Computational Thinking II

Predict, run, compare

A library fine is money for a late book: ₹1 a day. After more than 7 days late, you see the teacher. A chart is pinned above the desk. Does the chart match the rule?

Read the days late.
Step 1 of 5
  1. Read the days late.
  2. The diamond asks: 7 days or more?
  3. A book 7 days late: Yes.
  4. The chart says: see the teacher.
  5. The rule says: pay ₹7.

No. For a book 7 days late, the chart and the rule differ.

The rule

Predict first. Run it. The first difference points to the bug. A bug is a mistake in a plan or program.

The rule says you see the teacher after more than 7 days. Find the book where the chart and the rule differ. A "7 or more" check includes 7. "More than 7" does not.

Watch out!

A chart that passes one test can still be wrong. The limit is the number where the rule changes. Try the day right at the limit too, here 7 days.

Make the chart agree with every book.

Loading lab…

Jump to lesson

This track

  1. 0 Start here
  2. 1 Steps written, steps taken
  3. 2 Look at the middle
  4. 3 Ovals, boxes and diamonds
  5. 4 Give every case an answer
  6. 5 Predict, run, compare
  7. 6 The big picture
  8. 7 Track quiz

Other tracks