MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / rankine_to_kelvin

Function rankine_to_kelvin

conversions/temperature_conversions.py:286–303  ·  view source on GitHub ↗

Convert a given value from Rankine to Kelvin and round it to 2 decimal places. Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale Wikipedia reference: https://en.wikipedia.org/wiki/Kelvin >>> rankine_to_kelvin(0) 0.0 >>> rankine_to_kelvin(20.0) 11.11 >

(rankine: float, ndigits: int = 2)

Source from the content-addressed store, hash-verified

284
285
286def rankine_to_kelvin(rankine: float, ndigits: int = 2) -> float:
287 """
288 Convert a given value from Rankine to Kelvin and round it to 2 decimal places.
289 Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale
290 Wikipedia reference: https://en.wikipedia.org/wiki/Kelvin
291
292 >>> rankine_to_kelvin(0)
293 0.0
294 >>> rankine_to_kelvin(20.0)
295 11.11
296 >>> rankine_to_kelvin("40")
297 22.22
298 >>> rankine_to_kelvin("rankine")
299 Traceback (most recent call last):
300 ...
301 ValueError: could not convert string to float: 'rankine'
302 """
303 return round((float(rankine) * 5 / 9), ndigits)
304
305
306def reaumur_to_kelvin(reaumur: float, ndigits: int = 2) -> float:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected