Tag Archives: ppmmc

Programming, Probability, and the Modern Mathematics Classroom — Exercises Part 1

This post is part of the ppmmc series.

Some introductory exercises

Students should try to identify what the code does in general and be able to explain what each line of code does. These are not trick questions. When students are first learning something like programming, stay away from corner cases until students become comfortable with the language.

Since this post is on a public forum for all to read and ridicule, some general disclaimers: I know about Python’s style guide. The code is written using overly verbose variable names. This is done on purpose. I am not going to keep a watchful eye on my Python style. I am also not going to engage in extra-careful type-checking / error-handling in my code. This is neither the time nor the place to inundate students with this level of detail and pedantry. Instead, that will be something they grow into. Much the same way that when a child is learning to speak a language — we first just let them speak and only later do we begin to formalize their speech — so should be the case when learning any subject. Formalize later.

Finally, what’s provided is in writing and hence incomplete for anyone’s needs. I ask instructors to add their own flavor and style to the exercises provided as I don’t necessarily believe in canned pedagogical methods. Each student in each class is different and what’s provided in the link below may not be directly applicable — hence, customize to your needs. There is not one way to do this. As this is also about probability, remember to discuss probability theory when going over some of the exercises! I don’t emphasize that in the exercises because I would expect instructors to engage students in a manner appropriate for their class.

With that said, here are exercises ready for download as .pdf (Displaying Python code in HTML is a bit of a pain since whitespace in Python matters. \(\LaTeX\) to the rescue.).

Download: programming_probability_part1.pdf