← Back to challenges

Conversion of Units of Temperature

PythonHardphysicsmath

Instructions

Create a function that takes a temperature scale and a temperature measurement as arguments and returns a list with the conversion of such measurement to different scales.

NameInputSymbol
CelsiusceldegC
FahrenheitfahdegF
KelvinkelK
RankinerandegR
DelisledeldegDe
NewtonnewdegN
RéaumurreadegRe
RømerromdegRo

The resulting list should follow the order informed in the table above, and each corresponding temperature value should display two decimal digits.

Examples

temperature("cel", 0) ➞ ["0.00 degC", "32.00 degF", "273.15 K", "491.67 degR", "150.00 degDe", "0.00 degN", "0.00 degRe", "7.50 degRo"]

temperature("fah", -202) ➞ ["-130.00 degC", "-202.00 degF", "143.15 K", "257.67 degR", "345.00 degDe", "-42.90 degN", "-104.00 degRe", "-60.75 degRo"]

temperature("rom", 217.50) ➞ ["400.00 degC", "752.00 degF", "673.15 K", "1211.67 degR", "-450.00 degDe", "132.00 degN", "320.00 degRe", "217.50 degRo"]

Notes

  • All measurements will be valid temperatures according to the scale.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.