The Monte Hall Problem

Instructions

  • Read input number into variable.
  • Define a variable to count the number of wins and initialize it to 0.
  • Use a for loop to do the experiment the requested number of times:
    • Host hides prize behind a random door. Define a variable for this and set it to a random number from 1 to 3.
    • Contestant selects a random door. Define a variable for this and set it to a random number from 1 to 3.
    • Host reveals an unchosen door not containing prize. A reasonable way to do this is to define a variable and set it to a random number from 1 to 3, then use a while loop to reset it as long as it equals the prize door or the chosen door.
    • Contestant switches to another door. This will be the door not chosen and not revealed. (A quick computation would be 1 + 2 + 3 – chosen door – revealed door.)
    • If the switched-to door is also the prize door, add 1 to the wins count.
  • Show the win percentage (wins / trials).

2 Links

  • Facebook and Apple are backing a new course that gives kids college credit for learning to code — and it’s the fastest-growing AP course ever
  • Half a billion people now have reason to be furious with Marriott

    Marriott, the world’s largest hotel chain, revealed a hack of its Starwood hotels guest database today, potentially affecting a staggering 500 million people who booked stays at a Starwood property for years before Sept. 10, 2018.

    In its statement, Marriott said: “For approximately 327 million of these [500 million] guests, the information includes some combination of name, mailing address, phone number, email address, passport number, Starwood Preferred Guest (‘SPG’) account information, date of birth, gender, arrival and departure information, reservation date, and communication preferences.” Even worse, the company noted that for some, payment card numbers and expiration dates were also accessed; although this information was encrypted, Marriott “can’t rule out the possibility” that the components needed to decrypt this information may have also been taken.