Convert a given value from Rankine to Celsius and round it to 2 decimal places. Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale Wikipedia reference: https://en.wikipedia.org/wiki/Celsius >>> rankine_to_celsius(273.354, 3) -121.287 >>> rankine_to_celsius(273
(rankine: float, ndigits: int = 2)
| 240 | |
| 241 | |
| 242 | def rankine_to_celsius(rankine: float, ndigits: int = 2) -> float: |
| 243 | """ |
| 244 | Convert a given value from Rankine to Celsius and round it to 2 decimal places. |
| 245 | Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale |
| 246 | Wikipedia reference: https://en.wikipedia.org/wiki/Celsius |
| 247 | |
| 248 | >>> rankine_to_celsius(273.354, 3) |
| 249 | -121.287 |
| 250 | >>> rankine_to_celsius(273.354, 0) |
| 251 | -121.0 |
| 252 | >>> rankine_to_celsius(273.15) |
| 253 | -121.4 |
| 254 | >>> rankine_to_celsius(300) |
| 255 | -106.48 |
| 256 | >>> rankine_to_celsius("315.5") |
| 257 | -97.87 |
| 258 | >>> rankine_to_celsius("rankine") |
| 259 | Traceback (most recent call last): |
| 260 | ... |
| 261 | ValueError: could not convert string to float: 'rankine' |
| 262 | """ |
| 263 | return round((float(rankine) - 491.67) * 5 / 9, ndigits) |
| 264 | |
| 265 | |
| 266 | def rankine_to_fahrenheit(rankine: float, ndigits: int = 2) -> float: |
nothing calls this directly
no outgoing calls
no test coverage detected