Python can function as a basic calculator, allowing you to perform computations, however basic, much faster than most of us could using our own brainpower.

Here is a basic example:

print(1 + 1)


This will output:

2


Notice how we use print statements from Lesson 1 to display the output of this addition. Now this was a pretty simple calculation, but how about this one:

print(1581 * (7502 / (3.5 + 1)) - 0.25**5)


In less than half a second, Python outputs:

2635702.665690104


Notice here that we utilized addition, subtraction, multiplication, and division in this one expression, with some not so friendly numbers! We also added an exponential (denoted by the double asterisks **) at the end.

Let’s now practice doing some other computations in Python:

1. Compute the sum of 3 and 5. Divide it by the product of 10.5 and 0.6. (solution)

2. Compute the product of 12345 and 6789. Then subtract from it 0.951. (solution)