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

Function rankine_to_fahrenheit

conversions/temperature_conversions.py:266–283  ·  view source on GitHub ↗

Convert a given value from Rankine to Fahrenheit and round it to 2 decimal places. Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale Wikipedia reference: https://en.wikipedia.org/wiki/Fahrenheit >>> rankine_to_fahrenheit(273.15) -186.52 >>> rankine_to_fahrenh

(rankine: float, ndigits: int = 2)

Source from the content-addressed store, hash-verified

264
265
266def rankine_to_fahrenheit(rankine: float, ndigits: int = 2) -> float:
267 """
268 Convert a given value from Rankine to Fahrenheit and round it to 2 decimal places.
269 Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale
270 Wikipedia reference: https://en.wikipedia.org/wiki/Fahrenheit
271
272 >>> rankine_to_fahrenheit(273.15)
273 -186.52
274 >>> rankine_to_fahrenheit(300)
275 -159.67
276 >>> rankine_to_fahrenheit("315.5")
277 -144.17
278 >>> rankine_to_fahrenheit("rankine")
279 Traceback (most recent call last):
280 ...
281 ValueError: could not convert string to float: 'rankine'
282 """
283 return round(float(rankine) - 459.67, ndigits)
284
285
286def rankine_to_kelvin(rankine: float, ndigits: int = 2) -> float:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected