All of the examples on this page include a solution with manual calculations. The latter half of the examples also include a possible Python solution.
Example 1: Milk Tea (Simple)
Kevin went to get milk tea at his go-to spot, TPumps. His drink toppings consists of 50% honey boba, 10% popping boba, and 40% lychee jelly. There's a 12.5% chance that Kevin gets both popping boba and lychee jelly in one sip of his milk tea. What is the probability that when Kevin takes his first sip of his milk tea, he gets either popping boba or lychee jelly?
We can then calculate: P(popping boba or lychee jelly) = 0.1 + 0.4 - 0.125= 0.375
Example 2: A Lottery (Simple)
As recognition for completing a complex coding project, Emily and Dhiraj are entered into a lottery of 100 people for a gift card worth $1,000. The winner's name is randomly selected from a hat. What is the probability that Dhiraj or Emily's name is drawn as the winner of the gift card?
Example 2 Solution:
Hand Calculations:
P(Dhiraj) = 1⁄100 = 0.01 P(Emily) = 1⁄100 = 0.01 Dhiraj and Emily's names can't be drawn at the same time, meaning the two events are mutually exclusive! So P(Dhiraj and Emily) = 0
We can them calculate: P(Emily or Dhiraj) = 0.01 + 0.01 = 0.02
Example 3: Newspaper Articles
Prompt: A newspaper corporation asked Talia to review the quality of their work by randomly selecting one of their articles from the past month to read. In the past month:
53 articles were written
21 of the articles focused on 'politics', 16 of the articles focused on 'food', and 16 focused on 'climate change'.
40 of the articles contained more than 1,000 words, and the rest contained less than 1,000 words.
Of the articles containing more than 1,000 words, 18 focused on 'politics', 8 focused on 'food', and 14 focused on 'climate change'.
What is the probability that the article Talia randomly selects to read contains less than 1,000 words or focuses on the subject of food?
Example 3 Solution:
Hand Calculations:
P(less than 1,000 words) = (53 - 40)⁄53 = 13⁄53 = 0.2453 P(food) = 16⁄53 = 0.3019 P(food and less than 1,000 words) = P(food) * P(less than 1,000 words | food) = 0.3019 * 8⁄16 = 0.1509
We can then calculate: P(food or less than 1,000 words) = 0.2453 + 0.3019 - 0.1509 = 0.3963
A detailed explanation of the multiplication rule is part of the DISCOVERY course content:
In a stadium of 15,000 seats, 6,150 seats are located on the bottom level, 8,000 seats are located on the top level, and 850 seats are located on the balcony. For the upcoming football game, the ticket masters decide that 1,000 seats on the bottom level, 100 seats on the balcony level, and 6,000 seats on the top level will be sold for a ticket price less than $200. What is the probability you can buy a seat that is either on the bottom level or for a ticket price less than $200?
Karen went hiking up a mountain and stumbled upon a pond of jellyfish. Next to the pond stood a sign detailing the jellyfish in the pond: 5 Fried Egg Jellyfish, 3 Upside-Down Jellyfish, 6 Cannonball Jellyfish, and 3 Helmet Jellyfish as well as a warning not to swim in the pond. Below is a DataFrame representing all the jellyfish living in the pond:
Tired fom her hike up the mountain, Karen decides to ignore the sign and instead take a relaxing swim in the pond. Of course, she's guaranteed to get stung by a jellyfish. What is the probability that Karen is stung by either a Fried Egg Jellyfish or a Cannonball Jellyfish?
Example 5 Solution:
Hand Calculations:
Total Jellyfish in the pond: 17 P(Fried Egg) = 5⁄17 = 0.2941 P(Cannonball) = 6⁄17 = 0.3529
Notice that in this question, (NAME) can't be stung by two jellyfish at once, so the two events are mutually exclusive. In other words, P(Fried Egg and Cannonball) = 0.
We can then calculate: P(Fried Egg or Cannonball) = 0.2941 + 0.3529 = 0.647
A group of 20 friends are trying to decide what to order for lunch. Five of the friends want to eat at Cheesecake Factory, eight of the friends want to eat at Counter, and the remaining seven want to eat at McDonald's. To fairly decide, the friends decide to put 20 slips of paper into a hat, each slip representing one friend's chosen restaurant. Below is a DataFrame representing all the pieces of paper in the hat:
import pandas as pd\n# Creating a DataFrame called 'hat' with a 'restaurant' column\nhat = pd.DataFrame([{'restaurant': 'Cheesecake Factory'},{'restaurant': 'McDonalds'},{'restaurant': 'Counter'},\n {'restaurant': 'McDonalds'},{'restaurant': 'Cheesecake Factory'},{'restaurant': 'Cheesecake Factory'},\n {'restaurant': 'Counter'},{'restaurant': 'Cheesecake Factory'},{'restaurant': 'McDonalds'},\n {'restaurant': 'Counter'},{'restaurant': 'Counter'},{'restaurant': 'McDonalds'},\n {'restaurant': 'Counter'},{'restaurant': 'McDonalds'},{'restaurant': 'Counter'},\n {'restaurant': 'McDonalds'},{'restaurant': 'Cheesecake Factory'},{'restaurant': 'Counter'},\n {'restaurant': 'McDonalds'},{'restaurant': 'Counter'}])\nhat
Reset CodeRun All to Here Python Output:
restaurant
0
Cheesecake Factory
1
McDonalds
2
Counter
3
McDonalds
4
Cheesecake Factory
5
Cheesecake Factory
6
Counter
7
Cheesecake Factory
8
McDonalds
9
Counter
10
Counter
11
McDonalds
12
Counter
13
McDonalds
14
Counter
15
McDonalds
16
Cheesecake Factory
17
Counter
18
McDonalds
19
Counter
One slip will be randomly selected as the winning restaurant for lunch. What is the probability that Cheesecake Factory or Counter is selected?
Example 6 Solution:
Hand Calculations
P(Cheesecake Factory) = 5⁄20 = 0.25 P(Counter) = 8⁄20 = 0.4 Notice that these are mutually exclusive: two restaurants can't be chosen at the same time. In other words, P(Cheesecake Factory and Counter) = 0.
We can then calculate: P(Cheesecake Factory or Counter) = 0.25 + 0.4 = 0.65