{"id":15827259,"url":"https://github.com/kalebu/monty-hall-problem-simulation-in-python","last_synced_at":"2025-04-01T18:30:55.828Z","repository":{"id":103910810,"uuid":"274354660","full_name":"Kalebu/Monty-Hall-Problem-Simulation-in-Python","owner":"Kalebu","description":"Simulating monty hall problem with python ","archived":false,"fork":false,"pushed_at":"2022-05-22T02:39:06.000Z","size":23,"stargazers_count":9,"open_issues_count":0,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T04:03:57.977Z","etag":null,"topics":["monty-hall-problem","python","python-for-math","python-monty-hall-problem","python-project-beginner","python-projects","python-tanzania","python3","tanzania"],"latest_commit_sha":null,"homepage":"https://kalebujordan.dev/simulate-monty-hall-problem-using-python/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kalebu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-23T08:42:11.000Z","updated_at":"2024-04-08T04:33:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"953e04c6-67a2-4bb8-b68d-85f55a276bf1","html_url":"https://github.com/Kalebu/Monty-Hall-Problem-Simulation-in-Python","commit_stats":{"total_commits":6,"total_committers":3,"mean_commits":2.0,"dds":0.5,"last_synced_commit":"14b1310aaa76c3ffda71dfdbc56b95a73de9e872"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kalebu%2FMonty-Hall-Problem-Simulation-in-Python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kalebu%2FMonty-Hall-Problem-Simulation-in-Python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kalebu%2FMonty-Hall-Problem-Simulation-in-Python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kalebu%2FMonty-Hall-Problem-Simulation-in-Python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kalebu","download_url":"https://codeload.github.com/Kalebu/Monty-Hall-Problem-Simulation-in-Python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246635949,"owners_count":20809331,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["monty-hall-problem","python","python-for-math","python-monty-hall-problem","python-project-beginner","python-projects","python-tanzania","python3","tanzania"],"created_at":"2024-10-05T10:02:39.983Z","updated_at":"2025-04-01T18:30:55.549Z","avatar_url":"https://github.com/Kalebu.png","language":"Python","readme":"\u003csamp\u003e\n  \n# [Monty-Hall-Problem-Simulation-in-Python](https://kalebujordan.dev/simulate-monty-hall-problem-using-python/)\n\nThe repository  acts as the source code for the [Monty hall problem simulation](https://kalebujordan.dev/simulate-monty-hall-problem-using-python/)\n\n\nWTH is Monty Hall Problem ?\n-----------------------------\nI'm a great fan of movies \u0026 thus where most of biggest motivation in STEM and coding came from, The first time I came across the Monty hall problem was when I was watching movie titled [21](https://en.wikipedia.org/wiki/21_(2008_film)).\n\n  \n\u003e_Assume There are three doors, and behind one of them is a car, while behind the other two are goats. If you choose the door with the car behind it, you win the car. Now, say you choose Door 1. The host Monty Hall then opens either Door 2 or Door 3, behind which is a goat. (He knows what is behind each door, and never opens the door with the car behind it.) Monty now gives you the choice: do you want to stick with Door 1, or switch to the other door. What should you do? Or does it matter?\n\nNow the battle lies *Emotion vs Math*, mathematically switching would give you a 2/3 probability of winning rather than sticking to the same door as the probabilty of winning a car among those two door would concentrate into one.\n\n\nHow are we going to Simulate ?\n-------------------------------\nIn this source code I have simulated this problem using random module to simulate the process, and supringly with enough trials the probability winning when you switch converge to 0.6666.. which is equivalent to 2/3.\n\n\nGetting started\n-----------------\nTo get started running the simulation for this code, you might wanna clone or download the repository first just as shown below;\n\n```bash\n$-\u003e git clone https://github.com/Kalebu/Monty-Hall-Problem-Simulation-in-Python\n\n```\n\nOpen terminal in a project directory\n------------------------------------\n\nOpen in a terminal in a project directory or you can just change a directory into the project directory and then run th app just as shown below;\n\n```bash\n$-\u003e cd Monty-Hall-Problem-Simulation-in-Python\n$ Monty-Hall-Problem-Simulation-in-Python-\u003e python app.py\n```\n\nDo some simulations \n-------------------------\nOnce you run the application, a very simple gui similar to what shown below will pop up with an entry box, write in it no of sample to be simulated and then press enter and then program will evaluate total wins for case of same choice or switching \n\n![](app.png)\n\nGive it a star \n--------------\nDid you find this information useful, then give it a star \n  \nReferences \n-------------\n  1.https://www.mathwarehouse.com/monty-hall-simulation-online/ \n\nCredits\n-----------\nAll the credits to [kalebu](github.com/kalebu) \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkalebu%2Fmonty-hall-problem-simulation-in-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkalebu%2Fmonty-hall-problem-simulation-in-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkalebu%2Fmonty-hall-problem-simulation-in-python/lists"}