The Calculator

At the prompt type 2 + 2 and then Enter:

>>> 2 + 2
4

A simple division:

>>> 3.0 / 2
1.5

Note that 3 / 2 without the decimal point returns an integer (whole number) forum

>>> 3 / 2
1

How much is 1 + 2 x 2 ? Is it 6 or 5?

>>> 1 + 2 * 2
5

The multiplication has priority over the sum. It first multiplies 2 x 2 and only then adds 1.

We can change priorities using parenthesis:

>>> (1 + 2) * 2
6

computer programming degree learning course tutorial