Advertisement
dewabe

Convert temperatures (C, F, K)

Mar 30th, 2021
586
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. def celcius_to_kelvin(C):
  2.     return C + 273.15
  3.  
  4. def fahrenheit_to_kelvin(F):
  5.     return F - 32 / 1.8 + 273.15
  6.            
  7. def kelvin_to_fahrenheit(K):
  8.     return 1.8 * (K - 273.15) + 32
  9.  
  10. def kelvin_to_celcius(K):
  11.     return K - 273.15
  12.  
  13. def celcius_to_fahrenheit(C):
  14.     return kelvin_to_fahrenheit(celcius_to_kelvin(C))
  15.  
  16. def fahrenheit_to_celcius(F):
  17.     return kelvin_to_celcius(fahrenheit_to_kelvin(F))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement