Intro to
Programming
(with Python)

Fall 2019
course
site

Thu Oct 24

Questions about anything at all?

Where we are :

Today : practice.

Chapter 9 is called "simulation and design" ... which discusses some ideas behind the practice of writing software. Please read that chapter.

We'll be discussing in class some of those ideas over the next week or so.

craps

Our goal today is to write together as a group a program that simulates the game of craps, and in particular estimates the odds of winning at craps.

See for example wikipedia - craps - rules of play for what exactly it means to "win at craps".

Writing software ideas (some from chapter 9) :

So let's do this together.


What we ended up with is the attached craps.py.

$ python craps.py 
-- Compute winning probability for craps --
How many games? (^d to exit) 100000
You won 49286 games out of 100000 which is an average of 0.4929

```

https://cs.marlboro.college /cours /fall2019 /python /notes /chap9
last modified Wed April 24 2024 12:01 pm

attachments [paper clip]

  last modified size
TXT craps.py Wed Apr 24 2024 12:01 pm 2.3K