Page 1 of 1

Python: (Probability) Dependent Probability

Posted: Tue Oct 07, 2025 4:51 am
by The Jason

Code: Select all

print(f "There are two chocolate, three vanilla, and four strawberry milkshakes. Without replacement, what is the chance of unknowingly picking a chocolate and then a vanilla?")

float(chocolate_shake) = 2/9

float(vanilla_shake) = 3/8

prob_of_this_scenario = chocolate_shake * vanilla_shake

percent_prob_of_this_scenario = prob_of_this_scenario * 100

print(f "The chance of unknowingly picking a chocolate and then a vanilla is {prob_of_this_scenario} which is {percent_prob_of_this_scenario}")
\(P_{D}(E_{1} \longrightarrow E_{2}...\longrightarrow E_{n + 1}) = \)
\(P(E_{1}) * P(E_{2}\,\, | \,\,E_{1}) ... *\,\,P(E_{n + 1}\,\, | \,\, E_{n}) \)

Given that:

\(P(E) = \dfrac{O_{F}}{O_{T}}\)

\(O_T \ne 0\)
Read: The dependent probability of event 1 and then event 2 and then event E_{n + 1} equals the probability of event 1 multiplied by the probability of event 2, given that event 1 already happened multiplied by event {n + 1}, given that event E_{n} already happened.

Given that

The probability of an event equals outcomes favored divided by outcomes total.

Outcomes total cannot equal zero
There are two chocolate, three vanilla and four strawberry shakes. Without replacement, what is the chance of unknowingly picking a chocolate and then a vanilla?
\(P_{D}(E_{1} \longrightarrow E_{2}) =
P(E_{1}) * P(E_{2}\,\,|\,\,E_{1})\)