Lesson 1 of 15
Sample Spaces & Events
The Language of Chance
A sample space is the set of all possible outcomes of a random experiment. An event is any subset of .
Classical probability applies when all outcomes are equally likely:
where is the number of outcomes in event .
# Rolling a fair die
omega = [1, 2, 3, 4, 5, 6]
even = [2, 4, 6]
p = len(even) / len(omega)
print(round(p, 4)) # 0.5
Set Operations on Events
| Operation | Notation | Meaning |
|---|---|---|
| Union | A or B occurs | |
| Intersection | A and B both occur | |
| Complement | A does not occur |
Your Task
Implement classical_probability(outcomes, event) that returns , rounded to 4 decimal places.
Pyodide loading...
Loading...
Click "Run" to execute your code.