What are we going to learn?
How to create a Python3 program that asks the user for two integer values and does some simple calculations with it (sum, difference, product, division).
What do you need to know beforehand?
Nothing. However, you do need to install a tool if you want to run the program, for instance Thonny (free, self-explanatory download and easy to use).
2 pieces of advice before we start:
- Write your code (= the instructions) step by step and try it out by running it (press F5).
- If there is an error, check brackets, quotation marks etc. and use Thonny’s assistant function (appears automatically). The debugger even points out the exact location of the error with a small ^ below it.
0. Install your tool (e.g. Thonny) and open it.
The larger empty field, where the cursor is, is called the editor where you can write instructions. The smaller empty field below is the console where you can see the result if you execute your instructions using F5.
1. Ask the user for an integer value, which is a number without any decimal points etc.
In the editor: We define a variable in which we store the number we get it: We choose a name, meaningful at best, like number1, and tell Thonny that we want to define it by using =. With the function input(), we set our variable equal to whatever is written into the console. Inside the brackets (), we can write an explanation for the user what he/she should write, but it needs to be in quotation marks.
In the console: Press F5 and you will be asked to type in a number. Do it.
If you want to see your result, you write the function print() in the editor and put your variable’s name in the brackets (). If you press F5, your number will appear in the console.
2. Ask the user for another integer value.
Repeat the process from 1. Unless you type in the first number required, you will not see any difference in the console. I use the example of 24 and 789 here.

You may notice that every time you press F5, the console runs the code (= your instructions) from the beginning.
3. Use those two values to make some calculations.
So far, we have only saved the integer values as the data type string (= text). Before we can do calculations, we need to change both variables by adding the function int() around each definition. This converts each one to an integer (= number) that we can use to make calculations.

a) Calculate the sum of the two numbers.
Just write the names of the two variables with a +, but put each name inside the function int(). This is necessary so Thonny knows that it is supposed to work with integers (= numbers) and not strings (text).
Don’t forget: If you want to see the result, you need to use the function print(), either putting it around everything or defining an additional variable as the sum and printing this one.
You can add a description such as “sum: “ beforehand if you want to, but remember to put it in quotation marks and you are going to have to add a comma to separate it from the calculation.

b) Calculate the difference of the two numbers.
Do the same as in a), but exchange the + for a -.

c) Calculate the product of the two numbers.
Do the same as in a), but exchange the + for a *.

d) Calculate the integer-based division of the two numbers (so no decimal point).
Do the same as in a), but exchange the + for a /.

e) Calculate the remainder of integer division of the two numbers (= what remains when you do the division because you cannot fit the second number anymore into the first one).
Do the same as in a), but exchange the + for a %.

YOU MADE IT! If you want a more complete approach to learning Python (including all the theory), you can have a look at the free pdf version of Think Python by Allen B. Downey.
Did I keep my promise of keeping it short and simple? If you have any questions or comments, just let me know. #mastery01