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 books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.