Convert a given value from Fahrenheit to Rankine and round it to 2 decimal places. Wikipedia reference: https://en.wikipedia.org/wiki/Fahrenheit Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale >>> fahrenheit_to_rankine(273.354, 3) 733.024 >>> fahrenheit_to_
(fahrenheit: float, ndigits: int = 2)
| 138 | |
| 139 | |
| 140 | def fahrenheit_to_rankine(fahrenheit: float, ndigits: int = 2) -> float: |
| 141 | """ |
| 142 | Convert a given value from Fahrenheit to Rankine and round it to 2 decimal places. |
| 143 | Wikipedia reference: https://en.wikipedia.org/wiki/Fahrenheit |
| 144 | Wikipedia reference: https://en.wikipedia.org/wiki/Rankine_scale |
| 145 | |
| 146 | >>> fahrenheit_to_rankine(273.354, 3) |
| 147 | 733.024 |
| 148 | >>> fahrenheit_to_rankine(273.354, 0) |
| 149 | 733.0 |
| 150 | >>> fahrenheit_to_rankine(0) |
| 151 | 459.67 |
| 152 | >>> fahrenheit_to_rankine(20.0) |
| 153 | 479.67 |
| 154 | >>> fahrenheit_to_rankine(40.0) |
| 155 | 499.67 |
| 156 | >>> fahrenheit_to_rankine(60) |
| 157 | 519.67 |
| 158 | >>> fahrenheit_to_rankine(80) |
| 159 | 539.67 |
| 160 | >>> fahrenheit_to_rankine("100") |
| 161 | 559.67 |
| 162 | >>> fahrenheit_to_rankine("fahrenheit") |
| 163 | Traceback (most recent call last): |
| 164 | ... |
| 165 | ValueError: could not convert string to float: 'fahrenheit' |
| 166 | """ |
| 167 | return round(float(fahrenheit) + 459.67, ndigits) |
| 168 | |
| 169 | |
| 170 | def kelvin_to_celsius(kelvin: float, ndigits: int = 2) -> float: |
nothing calls this directly
no outgoing calls
no test coverage detected