Extra Credit 2

Due: October 20, 2022
Points: 20



Take the program “monty3.py” that you wrote for Homework 2 and add another method.

Specifically, if the contestant decides whether to change doors at random, how does that affect the probability of her winning?

To see this, write a third routing montyrandom() that randomly determined whether the contestant should change doors, returning the Boolean True if the contestant wins and False if not.

The text output should be a third line that looks like this (again, your numbers may vary):


Randomly switching wins:  0.4975200 (49752 games)

Submit. Name your program “montyex.py” and submit it to the Extra Credit 2 area for this class on Canvas.


UC Davis sigil
Matt Bishop
Office: 2209 Watershed Sciences
Phone: +1 (530) 752-8060
Email: mabishop@ucdavis.edu
ECS 235A, Computer and Information Security
Version of October 11, 2022 at 12:43PM

You can also obtain a PDF version of this.

Valid HTML 4.01 Transitional Built with BBEdit Built on a Macintosh