4. Functions

Objectives

In this chapter, you’ll

Image Create custom functions.

Image Import and use Python Standard Library modules, such as random and math, to reuse code and avoid “reinventing the wheel.”

Image Pass data between functions.

Image Generate a range of random numbers.

See simulation techniques using random-number generation.

Seed the random number generator ...

Get Python for Programmers now with the O’Reilly learning platform.

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