You can also do some calculations using built-in elementary functions. For this we will need to import a module (i.e. peace of code) which contains such functions.
For elementary functions, we will need to import the module math which has
elementary functions. Let calculate $\sqrt{100}$:

Note we call “math.sqrt”, not simply “sqrt”.

Alternatively, you simply import all functions (in this case you do not need to type “math.” on front of each statement

Let us consider a logarithmic function:

Exercise: Change 100 to some other number and check the output

The math module provides access to mathematical constants and functions.

How do we know which functions can be used? There is a special command “dir()” which prints all implemented Python functions in the module “math”: