0
0
SciPydata~15 mins

Physical constants (speed of light, Planck) in SciPy - Mini Project: Build & Apply

Choose your learning style9 modes available
Using Physical Constants with SciPy
📖 Scenario: Scientists often use important physical constants like the speed of light and Planck's constant in their calculations. These constants help us understand the universe better.
🎯 Goal: You will create a small program that stores some physical constants from SciPy, selects one based on a condition, and then prints it out.
📋 What You'll Learn
Use the scipy.constants module to access physical constants
Create a dictionary with the speed of light and Planck's constant
Set a threshold value to compare the constants
Use a loop to find constants greater than the threshold
Print the constants that meet the condition
💡 Why This Matters
🌍 Real World
Scientists and engineers use physical constants in calculations for physics, chemistry, and engineering problems.
💼 Career
Knowing how to access and use physical constants programmatically is useful for data scientists working in scientific research and development.
Progress0 / 4 steps
1
Create a dictionary with physical constants
Import scipy.constants as const. Create a dictionary called phys_constants with two entries: 'speed_of_light' set to const.c and 'planck' set to const.h.
SciPy
Need a hint?

Use import scipy.constants as const to access constants. Then create a dictionary with keys 'speed_of_light' and 'planck' using const.c and const.h.

2
Set a threshold value
Create a variable called threshold and set it to 1e-30.
SciPy
Need a hint?

Just create a variable named threshold and assign it the value 1e-30.

3
Find constants greater than the threshold
Create a new dictionary called filtered_constants that includes only the items from phys_constants where the value is greater than threshold. Use a dictionary comprehension with key and value as variables.
SciPy
Need a hint?

Use a dictionary comprehension like {key: value for key, value in phys_constants.items() if value > threshold}.

4
Print the filtered constants
Print the filtered_constants dictionary.
SciPy
Need a hint?

Use print(filtered_constants) to show the result.