1 of 7

Lecture 14

Chance

DATA 8

Summer 2017

Slides created by John DeNero (denero@berkeley.edu), Ani Adhikari (adhikari@berkeley.edu), and Sam Lau (samlau95@berkeley.edu)

2 of 7

Announcements

3 of 7

Control Statements

4 of 7

Control Statements

These statements control the sequence of computations that are performed in a program

  • The keywords if and for begin control statements
  • The purpose of if is to define functions that choose different behavior based on their arguments
  • The purpose of for is to perform a computation for every element in a list or array

(Demo)

5 of 7

The Monty Hall Problem

6 of 7

Monty Hall Problem

7 of 7

Attendance