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 O’Reilly online learning.

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