三門問題模擬:換門跟不換門的中獎機率
✓ Published0🌍 Public
VVioletVivirand
Last edited Dec 29, 2020
Created on Dec 29, 2020
This visualization simulates the Monty Hall problem, showing the probability of winning a car when the contestant switches doors versus sticking with their initial choice. Two Python scripts, `threedoors.py` and `threedoors_v2.py`, each run 10,000 rounds of the game and print the final win counts for both strategies. Using the `random` module’s `randint` function, the code models door selection and prize placement, filtering out goat doors with Python’s `filter` and dictionary operations. The output reveals switching wins roughly twice as often as not switching, demonstrating the classic probability paradox.
AI-generated description