Challenge - 5 Problems
Unit Conversion Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of unit conversion using scipy.constants
What is the output of this code snippet that converts 10 kilometers to meters using scipy.constants?
SciPy
from scipy.constants import kilo value_km = 10 value_m = value_km * kilo print(value_m)
Attempts:
2 left
💡 Hint
Remember that 'kilo' in scipy.constants means 1000.
✗ Incorrect
The 'kilo' constant equals 1000. Multiplying 10 kilometers by 1000 converts it to meters: 10 * 1000 = 10000.
❓ data_output
intermediate2:00remaining
Convert array of temperatures from Celsius to Kelvin
Given an array of temperatures in Celsius, what is the resulting array after converting to Kelvin using numpy and scipy.constants?
SciPy
import numpy as np from scipy.constants import zero_Celsius celsius_temps = np.array([0, 25, 100]) kelvin_temps = celsius_temps + zero_Celsius print(kelvin_temps)
Attempts:
2 left
💡 Hint
Add 273.15 to Celsius to get Kelvin.
✗ Incorrect
The constant zero_Celsius equals 273.15. Adding it to Celsius temps converts them to Kelvin.
❓ visualization
advanced3:00remaining
Plotting unit conversions for length scales
Which option produces a plot showing meters converted to kilometers and centimeters correctly?
SciPy
import matplotlib.pyplot as plt from scipy.constants import kilo, centi lengths_m = [1, 5, 10] lengths_km = [x / kilo for x in lengths_m] lengths_cm = [x / centi for x in lengths_m] plt.plot(lengths_m, lengths_km, label='km') plt.plot(lengths_m, lengths_cm, label='cm') plt.xlabel('Meters') plt.ylabel('Converted Lengths') plt.legend() plt.show()
Attempts:
2 left
💡 Hint
Remember 1 meter = 0.001 kilometers and 100 centimeters.
✗ Incorrect
Kilometers are larger units than meters (1m = 0.001km), centimeters are smaller (1m = 100cm). The plot must reflect this.
🔧 Debug
advanced2:00remaining
Identify the error in unit conversion code
What is the error in this code when converting 5 grams to kilograms using scipy.constants?
SciPy
from scipy.constants import kilo mass_g = 5 mass_kg = mass_g * kilo print(mass_kg)
Attempts:
2 left
💡 Hint
Check the meaning of 'kilo' and the units involved.
✗ Incorrect
Multiplying grams by 1000 (kilo) converts grams to milligrams, not kilograms. The output 5000.0 is wrong for grams to kilograms.
🚀 Application
expert3:00remaining
Calculate energy in electronvolts from joules using scipy.constants
Which option correctly calculates the energy in electronvolts (eV) from 3.2e-19 joules using scipy.constants?
SciPy
from scipy.constants import electron_volt energy_joules = 3.2e-19 energy_ev = energy_joules / electron_volt print(energy_ev)
Attempts:
2 left
💡 Hint
1 electronvolt equals 1.6e-19 joules.
✗ Incorrect
Dividing 3.2e-19 joules by 1.6e-19 joules/eV gives 2 eV.