Bird
Raised Fist0
SciPydata~20 mins

Physical constants (speed of light, Planck) in SciPy - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
๐ŸŽ–๏ธ
Physical Constants Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
โ“ Predict Output
intermediate
2:00remaining
Calculate energy of a photon using Planck's constant and frequency
Given the frequency of a photon as 5e14 Hz, what is the energy of this photon using Planck's constant from scipy.constants?
SciPy
from scipy.constants import h
frequency = 5e14
energy = h * frequency
print(energy)
A1.5e-19
B6.626e-34
C3.313e-19
D9.11e-31
Attempts:
2 left
๐Ÿ’ก Hint
Energy of a photon is Planck's constant times frequency.
โ“ data_output
intermediate
1:30remaining
Retrieve and display speed of light and Planck constant values
Using scipy.constants, what are the values of the speed of light and Planck constant printed as a tuple (speed_of_light, planck_constant)?
SciPy
from scipy.constants import c, h
print((c, h))
A(3.14e8, 6.626e-34)
B(3e8, 6.626e-34)
C(299792458, 1.602e-19)
D(299792458.0, 6.62607015e-34)
Attempts:
2 left
๐Ÿ’ก Hint
Use scipy.constants.c and scipy.constants.h for exact values.
๐Ÿง  Conceptual
advanced
1:30remaining
Understanding units of Planck constant and speed of light
Which of the following correctly describes the units of Planck constant and speed of light?
APlanck constant: Joule seconds (Jยทs), Speed of light: meters per second (m/s)
BPlanck constant: meters per second (m/s), Speed of light: Joule seconds (Jยทs)
CPlanck constant: kilograms (kg), Speed of light: seconds (s)
DPlanck constant: Newtons (N), Speed of light: meters (m)
Attempts:
2 left
๐Ÿ’ก Hint
Think about what Planck constant and speed of light physically represent.
๐Ÿ”ง Debug
advanced
1:30remaining
Identify the error in this code using scipy.constants
What error does the following code produce? from scipy.constants import speed_of_light print(speed_of_light)
SciPy
from scipy.constants import speed_of_light
print(speed_of_light)
AImportError: cannot import name 'speed_of_light'
BNameError: name 'speed_of_light' is not defined
CAttributeError: module 'scipy.constants' has no attribute 'speed_of_light'
DNo error, prints 299792458.0
Attempts:
2 left
๐Ÿ’ก Hint
Check the exact name of the constant in scipy.constants.
๐Ÿš€ Application
expert
2:30remaining
Calculate wavelength from photon energy using scipy.constants
Given a photon energy of 4e-19 Joules, calculate the wavelength in meters using Planck constant and speed of light from scipy.constants. Which option is the correct wavelength?
SciPy
from scipy.constants import h, c
energy = 4e-19
wavelength = (h * c) / energy
print(wavelength)
A7.50e-07
B4.97e-07
C1.24e-06
D3.31e-19
Attempts:
2 left
๐Ÿ’ก Hint
Use wavelength = (Planck constant * speed of light) / energy.

Practice

(1/5)
1. What is the value of the speed of light constant c in scipy.constants measured in?
easy
A. Meters per second
B. Kilometers per hour
C. Miles per second
D. Feet per second

Solution

  1. Step 1: Understand the unit of speed of light in scipy.constants

    The speed of light c in scipy.constants is given in meters per second (m/s), which is the standard SI unit for speed.
  2. Step 2: Confirm the unit from official documentation or usage

    Checking the official scipy documentation confirms c is in meters per second.
  3. Final Answer:

    Meters per second -> Option A
  4. Quick Check:

    Speed of light unit = meters per second [OK]
Hint: Speed of light is always in meters per second [OK]
Common Mistakes:
  • Confusing meters per second with kilometers per hour
  • Assuming miles or feet units
  • Not checking scipy documentation
2. Which of the following is the correct way to import and access Planck's constant from scipy.constants?
easy
A. import scipy.constants; scipy.constants.planck
B. import scipy.constants as sc; sc.Planck
C. from scipy.constants import Planck
D. from scipy.constants import planck

Solution

  1. Step 1: Recall the exact attribute name for Planck's constant

    In scipy.constants, Planck's constant is accessed as planck (all lowercase).
  2. Step 2: Check import syntax correctness

    import scipy.constants; scipy.constants.planck uses import scipy.constants and accesses scipy.constants.planck, which is correct. from scipy.constants import planck tries to import planck directly, which is valid but not the exact syntax shown here. import scipy.constants as sc; sc.Planck uses incorrect capitalization Planck. from scipy.constants import Planck also uses wrong capitalization and import style.
  3. Final Answer:

    import scipy.constants; scipy.constants.planck -> Option A
  4. Quick Check:

    Correct attribute name is planck, accessed via scipy.constants [OK]
Hint: Planck constant is lowercase 'planck' in scipy.constants [OK]
Common Mistakes:
  • Using uppercase 'Planck' instead of lowercase
  • Incorrect import syntax
  • Trying to import planck directly without correct syntax
3. What is the output of this code snippet?
from scipy.constants import c, planck
wavelength = 500e-9  # 500 nm in meters
energy = planck * c / wavelength
print(round(energy, 20))
medium
A. 3.972891714285714e-16
B. 3.972891714285714e-25
C. 3.972891714285714e-22
D. 3.972891714285714e-19

Solution

  1. Step 1: Calculate photon energy using formula E = h * c / wavelength

    Given wavelength = 500 nm = 500e-9 m, Planck's constant (h) and speed of light (c) are constants from scipy.constants. Calculate energy = planck * c / wavelength.
  2. Step 2: Perform calculation and round result

    Using scipy.constants values: planck โ‰ˆ 6.62607015e-34, c โ‰ˆ 299792458, energy โ‰ˆ (6.62607015e-34 * 299792458) / 500e-9 = 3.972891714285714e-19 J. Rounded to 20 decimals matches 3.972891714285714e-19.
  3. Final Answer:

    3.972891714285714e-19 -> Option D
  4. Quick Check:

    Energy = h*c/wavelength = 3.97e-19 J [OK]
Hint: Use E = h*c/wavelength formula with correct units [OK]
Common Mistakes:
  • Forgetting to convert nm to meters
  • Mixing up multiplication and division
  • Rounding too early or incorrectly
4. Identify the error in this code snippet that tries to calculate photon energy:
from scipy.constants import Planck, c
wavelength = 600e-9
energy = Planck * c / wavelength
print(energy)
medium
A. Missing import for speed of light
B. Wavelength should be in nanometers, not meters
C. Planck constant is incorrectly capitalized
D. Division operator should be multiplication

Solution

  1. Step 1: Check import statement for Planck constant

    The code imports Planck with uppercase 'P', but in scipy.constants it is lowercase planck. This causes an AttributeError.
  2. Step 2: Verify other parts of the code

    Wavelength is correctly converted to meters (600e-9), speed of light c is imported correctly, and the formula uses correct division. So no other errors.
  3. Final Answer:

    Planck constant is incorrectly capitalized -> Option C
  4. Quick Check:

    Correct attribute is 'planck' lowercase [OK]
Hint: Check exact case for constants in scipy.constants [OK]
Common Mistakes:
  • Using uppercase 'Planck' instead of lowercase
  • Confusing units of wavelength
  • Wrong operator in formula
5. You want to calculate the energy of a photon with wavelength 400 nm using scipy.constants. Which code snippet correctly computes and prints the energy in electronvolts (eV)?
hard
A. from scipy.constants import c, planck wavelength = 400e-9 energy_ev = planck * c / wavelength print(round(energy_ev, 3))
B. from scipy.constants import c, planck, electron_volt wavelength = 400e-9 energy_joule = planck * c / wavelength energy_ev = energy_joule / electron_volt print(round(energy_ev, 3))
C. from scipy.constants import c, planck, electron_volt wavelength = 400 energy_joule = planck * c / wavelength energy_ev = energy_joule * electron_volt print(round(energy_ev, 3))
D. from scipy.constants import c, planck wavelength = 400e-9 energy_joule = planck * c * wavelength print(round(energy_joule, 3))

Solution

  1. Step 1: Calculate photon energy in joules using E = h*c / wavelength

    Use wavelength in meters (400e-9). Calculate energy_joule = planck * c / wavelength.
  2. Step 2: Convert energy from joules to electronvolts

    Divide energy_joule by electron_volt constant to get energy in eV.
  3. Step 3: Check code correctness

    from scipy.constants import c, planck, electron_volt wavelength = 400e-9 energy_joule = planck * c / wavelength energy_ev = energy_joule / electron_volt print(round(energy_ev, 3)) correctly imports electron_volt, converts units properly, and prints rounded value. Other options either miss conversion, use wrong wavelength units, or wrong formula.
  4. Final Answer:

    from scipy.constants import c, planck, electron_volt wavelength = 400e-9 energy_joule = planck * c / wavelength energy_ev = energy_joule / electron_volt print(round(energy_ev, 3)) -> Option B
  5. Quick Check:

    Energy (eV) = (h*c/wavelength)/electron_volt [OK]
Hint: Convert joules to eV by dividing by electron_volt constant [OK]
Common Mistakes:
  • Skipping conversion from joules to eV
  • Using wavelength in nm without converting to meters
  • Multiplying instead of dividing for energy calculation
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard