Pattern Finding "Laziness"
It may sound weird, but coders are proud to be “lazy." Or rather, they prefer to reduce the effort required to accomplish a task whenever possible. In order to be good at minimizing effort, we need to understand how to use patterns to our advantage.
Example: Suppose I wanted to teach the computer to draw the following picture:
In order to draw the squares above, my code might look like the following:
Do you think a lazy coder would want to pull out ALL of those blocks and connect them together? No WAY! Coders need to develop the ability to find patterns in the code so they can avoid repetitive nonsense like this. Once they improve their skills of finding patterns, they are one step closer to coding in all their LAZY glory!!! Can you find the pattern in the following five examples?
-
2, 3, 5, 8, 12, 17, ___, ___, ___.
- 4, 9,16, 25, 36, 49, ____, ____, ____.
Just for fun, here's one more challenge. Patterns are often used to create and decode messages, like this shift cipher below:
“Oggv og cv pqqp cv vjg jgcfswctvgtu.”