Convert a given value from Kelvin to Rankine and round it to 2 decimal places. Wikipedia reference: https://en.wikipedia.org/wiki/Kelvin Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale >>> kelvin_to_rankine(273.354, 3) 492.037 >>> kelvin_to_rankine(273.354,
(kelvin: float, ndigits: int = 2)
| 216 | |
| 217 | |
| 218 | def kelvin_to_rankine(kelvin: float, ndigits: int = 2) -> float: |
| 219 | """ |
| 220 | Convert a given value from Kelvin to Rankine and round it to 2 decimal places. |
| 221 | Wikipedia reference: https://en.wikipedia.org/wiki/Kelvin |
| 222 | Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale |
| 223 | |
| 224 | >>> kelvin_to_rankine(273.354, 3) |
| 225 | 492.037 |
| 226 | >>> kelvin_to_rankine(273.354, 0) |
| 227 | 492.0 |
| 228 | >>> kelvin_to_rankine(0) |
| 229 | 0.0 |
| 230 | >>> kelvin_to_rankine(20.0) |
| 231 | 36.0 |
| 232 | >>> kelvin_to_rankine("40") |
| 233 | 72.0 |
| 234 | >>> kelvin_to_rankine("kelvin") |
| 235 | Traceback (most recent call last): |
| 236 | ... |
| 237 | ValueError: could not convert string to float: 'kelvin' |
| 238 | """ |
| 239 | return round((float(kelvin) * 9 / 5), ndigits) |
| 240 | |
| 241 | |
| 242 | def rankine_to_celsius(rankine: float, ndigits: int = 2) -> float: |
nothing calls this directly
no outgoing calls
no test coverage detected