<jupyter_start><jupyter_text>Drill - Exercises in Probability  1. Calculate the probability of flipping a balanced coin four times and getting each pattern: HTTH, HHHH and TTHH.<jupyter_code>coin_prob = {'H': 1/2, 'T': 1/2}

flip_sequences = ['HTTH', 'HHHH', 'TTHH']

sequence_prob = []

for flips in flip_sequences:
    flips_prob = 1
    for char in flips:
        flips_prob *= coin_prob[char]
    sequence_prob.append(flips_prob)

print("Probability of coin flip patterns: ", list(zip(flip_sequences, sequence_prob)))<jupyter_output>Probability of coin flip patterns:  [('HTTH', 0.0625), ('HHHH', 0.0625), ('TTHH', 0.0625)]<jupyter_text>-------------------------------------------------------------------------------------------------------------------------  2. If a list of people has 24 women and 21 men, then the probability of choosing a man from the list is 21/45. What is the probability of not choosing a man?<jupyter_code>people = {'women': 24, 'men': 21}
sum(people.values())
prob_man = people['men'] / sum(people.values())
prob_not_man = 1 - prob_man
print("Probability of NOT choosing a man: ", prob_not_man)<jupyter_output>Probability of NOT choosing a man:  0.5333333333333333<jupyter_text>-------------------------------------------------------------------------------------------------------------------------  3. The probability that Bernice will travel by plane sometime in the next year is 10%. The probability of a plane crash at any time is .005%. What is the probability that Bernice will be in a plane crash sometime in the next year?<jupyter_code>prob_trav_plane = 0.1
prob_plane_crash_anytime = 0.00005
print("Probability of Bernice being in a plane crash in the next year: ", prob_trav_plane * prob_plane_crash_anytime)<jupyter_output>Probability of Bernice being in a plane crash in the next year:  5e-06
{'fraction_non_alphanumeric': 0.21689373297002726, 'fraction_numerical': 0.03760217983651226, 'mean_word_length': 2.6284584980237153, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '422771', 'license': 'MIT', 'n_tokens_mistral': 590, 'n_tokens_neox': 525, 'n_words': 192, 'path': 'thinkful/data_science/my_progress/intro_data_science_fundamentals/unit_3_drills/Unit_3_-_Lesson_2_-_Drill_-_Exercises_in_Probability.ipynb', 'repo_name': 'djrgit/coursework', 'size': '1835'}