{}

Build your resume with HTML & CSS and win $100

Get featured on Programiz PRO and the Wall of Inspiration.

Build your resume with HTML & CSS and win $100

Join Challenge →
Join Challenge →

Build your resume with HTML & CSS and win $100

Get featured on Programiz PRO and the Wall of Inspiration.

Build your resume with HTML & CSS and win $100

Join Challenge →
Join Challenge →
run-icon
main.py
# Online Python compiler (interpreter) to run Python online. # Write Python 3 code in this online editor and run it. import numpy as np doors = ["goat","goat","car"] #1st choice will be door you choose, 2nd choice will be door that is revealed. #This code simulates your selection of a door, and the door that is randomly revealed. print("test:",np.random.choice(doors,2,replace=False)) num_cars_won_if_switched = 0 num_goats_revealed = 0 for i in range(10000): trial = np.random.choice(doors,2,replace=False) if trial[1] == "goat": #door revealed was a goat num_goats_revealed += 1 if trial[0] == "goat": num_cars_won_if_switched += 1 print(num_cars_won_if_switched/num_goats_revealed)
Output