2 of 1 ·Logical reasoning

Lesson 2 · Computational Thinking
Deduce the rule from examples.
Patterns & Logic
A pattern follows a rule. Red, blue, red, blue repeats two colours. Say the rule first, then try another example. A few examples may fit more than one rule.
Click to zoomWorking out what must be trueLogic is figuring out what has to be true, based only on what you already know. No guessing, no hoping.
If every student in Class 7 wears a blue tie, and Ananya is in Class 7, then Ananya wears a blue tie. You don't need to see her. It must be true.
Computers run entirely on this kind of reasoning. Every "if" you ever write is a small logical deduction.
Click to zoomCareful — 'all' does not work backwardsHere's the trap that catches almost everyone.
"All cats have four legs" is true. Does it follow that "everything with four legs is a cat"? No — tables, dogs and goats say otherwise.
The rule only runs in the direction it was stated. Reversing it is one of the oldest mistakes in reasoning, and it produces some very confident, very wrong conclusions.
7 more parts in this lesson
Walkthroughs, code labs, mini-games and the checkpoint quiz unlock when you buy the course.