<jupyter_start><jupyter_text>The Monty Hall Problem **Please run all cells before this cell, including the import cell at the top of the notebook.**<jupyter_code>goats = make_array('first goat', 'second goat')
hidden_behind_doors = np.append(goats, 'car')
hidden_behind_doors
def other_goat(goat):
    if goat == 'first goat':
        return 'second goat'
    if goat == 'second goat':
        return 'first goat'
other_goat("first goat")
other_goat("second goat")
other_goat("sheep")
contestant_goat = np.random.choice(hidden_behind_doors)
contestant_goat
def monty_hall_game():
    """[contestant's guess, revealed, remains]"""
    contestant_guess = np.random.choice(hidden_behind_doors)
    
    if contestant_guess == 'first goat':
        return ['first goat', 'second goat', 'car']
    elif contestant_guess == 'second goat':
        return ['second goat', 'first goat', 'car']
    elif contestant_guess == 'car':
        revealed = np.random.choice(goats)
        return ['car', revealed, other_goat(revealed)]
monty_hall_game()
trials = Table(['guess', 'revealed', 'remains'])
trials
trials.append(monty_hall_game())
trials.append(monty_hall_game())
trials.append(monty_hall_game())
trials.append(monty_hall_game())
trials.append(monty_hall_game())
trials
for i in np.arange(9995):
    trials.append(monty_hall_game())
trials.pivot('remains', 'guess')
trials.group('guess')
trials.group('remains')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13857938718662952, 'fraction_numerical': 0.002785515320334262, 'mean_word_length': 5.386666666666667, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '577134', 'license': 'MIT', 'n_tokens_mistral': 513, 'n_tokens_neox': 490, 'n_words': 111, 'path': 'Data8.2x/Data8.2x_lec2.ipynb', 'repo_name': 'ayush1202/Data8x-Berkeley', 'size': '1436'}