Back to Contents

Getting Ready

This book is about teaching the computer to do new things by writing computer programs. Just as there are different languages for humans to speak to one another, there are different programming languages for humans to speak to computers.

We are going to be using a programming language called Python. A Python system might already be on your computer, or you may have to find it on the internet and install it yourself. You will know that you have it working when you see something like this:

Python 3.8.2 (default, Feb 24 2020, 18:27:02) 
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Make sure the Python version number in the first line, here Python 3.8.2, is at least 3. You might need to type python3 instead of python to achieve this. Python is waiting for us to type something. Try typing 1 + 2 followed by the Enter key. You should see this:

Python
>>> 1 + 2
3
>>> 

(We have abbreviated Python’s welcome message). Python tells us the result of the calculation. You may use the left and right arrow keys on the keyboard to correct mistakes and the up and down arrow keys to look through a history of previous inputs. You can also use your computer’s usual copy and paste functions, instead of typing directly into Python, if you like.

To abandon typing, and ask Python to forget what you have already typed, enter Ctrl-C (hold down the Ctrl key and tap the c key). This will allow you to start again. To leave Python altogether, give the  exit()  command, again followed by the Enter key:

Python
>>> exit()

You should find yourself back where you were before. We are ready to begin.