Functions That Python Provides

Python comes with many built-in functions that perform common operations. One example is abs, which produces the absolute value of a number:

 >>>​​ ​​abs(-9)
 >>>​​ ​​abs(3.3)

Each of these statements is a function call.

The general form of a function call is as follows:


An argument is an expression that appears between the parentheses of a function call. In abs(-9), the argument is -9.

Here, we calculate the difference between a day temperature and a night temperature, as might ...

Get Practical Programming, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.