0
0
SciPydata~30 mins

Normal distribution in SciPy - Mini Project: Build & Apply

Choose your learning style9 modes available
Exploring the Normal Distribution with SciPy
📖 Scenario: Imagine you work in a bakery that wants to understand the daily weight of its bread loaves. The weights follow a pattern called the normal distribution, which looks like a bell curve. You will use Python and SciPy to explore this pattern.
🎯 Goal: You will create data representing bread weights, set parameters for the normal distribution, calculate probabilities for certain weights, and finally display the results.
📋 What You'll Learn
Create a list of bread weights in grams
Set the mean and standard deviation for the normal distribution
Use SciPy to calculate the probability density function (PDF) for each weight
Print the list of weights and their corresponding PDF values
💡 Why This Matters
🌍 Real World
Normal distributions are common in quality control, like checking if bread weights stay consistent in a bakery.
💼 Career
Understanding and using normal distributions is important for data analysts and scientists to model real-world data and make decisions.
Progress0 / 4 steps
1
Create a list of bread weights
Create a list called bread_weights with these exact values: 250, 255, 260, 265, 270.
SciPy
Need a hint?

Use square brackets to create a list and separate the numbers with commas.

2
Set mean and standard deviation
Create two variables: mean_weight set to 260 and std_dev set to 7.
SciPy
Need a hint?

Use simple assignment to create these variables.

3
Calculate PDF values using SciPy
Import norm from scipy.stats. Then create a list called pdf_values that contains the PDF values for each weight in bread_weights using norm.pdf(weight, mean_weight, std_dev) inside a list comprehension.
SciPy
Need a hint?

Use a list comprehension to apply norm.pdf to each weight.

4
Print the weights and their PDF values
Use a for loop with variables weight and pdf to iterate over zip(bread_weights, pdf_values). Inside the loop, print the weight and its PDF value formatted as: Weight: {weight}g, PDF: {pdf:.5f}.
SciPy
Need a hint?

Use zip to pair weights and PDF values, then print each pair with formatted strings.