Randomness and Control Statements#

Susanna Lange

So far we have discussed different methods of storing data. But what can we do with data storage such as lists and arrays? We can use them to model a real-world example, like rolling dice or tossing a coin, or randomly selecting a subset of a population for a survey. We can also perform some action on each element of our data.

This chapter will introduce programming control statements, which allow us to select or iterate over statements and expressions. Additionally, we will cover the basics of random selection, including how to implement a random choice in Python.

We will utilize these ideas to simulate experiments, that is to imitate real-world examples using code.