0
0
NumPydata~15 mins

Normal distribution with normal() in NumPy - Mini Project: Build & Apply

Choose your learning style9 modes available
Normal distribution with normal()
📖 Scenario: You work in a bakery that wants to understand the daily weight of its bread loaves. The weights usually follow a normal pattern, with most loaves close to the average weight but some lighter or heavier.
🎯 Goal: You will create a list of bread weights using the normal distribution. Then, you will set the average weight and spread, generate the weights, and finally print them.
📋 What You'll Learn
Use numpy's normal() function to generate data
Create a variable for mean and standard deviation
Generate 10 bread weights
Print the list of weights
💡 Why This Matters
🌍 Real World
Bakeries and food industries use normal distribution to understand product weight variations and maintain quality.
💼 Career
Data scientists use normal distribution to model real-world data and make predictions or quality checks.
Progress0 / 4 steps
1
Create the bread weights data
Import numpy as np and create a variable called weights by calling np.array([]) to start an empty array.
NumPy
Need a hint?

Use import numpy as np to import numpy. Then create an empty numpy array with np.array([]).

2
Set mean and standard deviation
Create two variables: mean_weight set to 500 and std_dev set to 20.
NumPy
Need a hint?

Use simple assignment to create mean_weight and std_dev variables.

3
Generate bread weights using normal()
Use np.random.normal() with mean_weight, std_dev, and 10 to generate 10 bread weights. Assign the result to weights.
NumPy
Need a hint?

Call np.random.normal(mean_weight, std_dev, 10) to get 10 values and assign to weights.

4
Print the bread weights
Print the weights array to see the generated bread weights.
NumPy
Need a hint?

Use print(weights) to display the array of weights.