Last active
November 27, 2015 18:08
-
-
Save NotTheEconomist/850bcac0ed3a24f13535 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def convert_temp(): | |
'''Prints fahrenheit, celsius, and kelvin temps from user input''' | |
# helper functions to convert from fahrenheit | |
def celsius(temp_f): | |
return (5 / 9) * (temp_f - 32) | |
def kelvin(temp_f): | |
return (5 / 9) * (temp_f - 32) + 273.15 | |
f = float(input("Enter a temperature (in Fahrenheit): ")) | |
print("The temperature in Fahrenheit is {}".format(f)) | |
print("The temperature in Celsius is {}".format(celsius(f))) | |
print("The temperatore in Kelvin is {}".format(kelvin(f))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment