from pint import UnitRegistry ureg = UnitRegistry() temp_celsius = 20 temp_kelvin = temp_celsius * ureg.degC.to('kelvin') print(temp_kelvin)
293.15 kelvin
from pint import UnitRegistry ureg = UnitRegistry() distance = 10 * ureg.meter time = 2 * ureg.second velocity = distance / time print(velocity)
5.0 meter/secondOverall, the Python Pint UnitRegistry package is an excellent tool for performing unit conversions and arithmetic operations between physical quantities with ease.