Why we encourage typing out the code examples

We strongly encourage you to type these examples in to a Notebook of your own as you read through this material.

  • Typing out the examples and exercises gets you used to typing code into a notebook, and recognising when you have mistyped something.

  • Programming requires paying attention to details. Practicing typing out the examples and exercises trains you to concentrate on getting the details right. If you are not concentrating it will become obvious because your code will not run as expected.

  • With experience you will develop the skill of being able to look at code and see if something is not how you would expect. For example, you might be missing a bracket in a mathematical expression, or have a typo in a particular command. Typing out the exercises and examples gives you practice at reading other people’s code (the code in this book) and reading your own code, and spotting when things do not look the way they should.

  • Any programmer spends a lot of time finding and fixing mistakes (called bugs) in their code. Spotting and fixing bugs gets easier with experience. You will make mistakes when you make yourself type out bits of code, and figuring our where the mistake is and then correcting it will make you better at finding and squashing bugs in your own code later on.

  • Typing out code also forces you to slow down enough that your brain can start to process different ideas as you work with them. Just reading examples, or copying and pasting, might feel like you understand, but the information can be quickly forgotten.