Lesson 2 · Computational Thinking
Deduce the rule from examples.
Logic 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.
Here'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.
5 more parts in this lesson
Walkthroughs, code labs, mini-games and the checkpoint quiz unlock when you buy the course.