Skip to content

Instantly share code, notes, and snippets.

@shamikalashawn
Created February 1, 2017 03:17
Show Gist options
  • Save shamikalashawn/ffc29032e455f4ba01d0c4c43e99a1c5 to your computer and use it in GitHub Desktop.
Save shamikalashawn/ffc29032e455f4ba01d0c4c43e99a1c5 to your computer and use it in GitHub Desktop.
Give me the temperature in Celsius and I'll give it to you straight, in Fahrenheit. And vice versa.
def fahrenheit_to_Celsius():
fahrenheit = float(input('Please enter the temperature in Fahrenheit: '))
celsius = (5/9.0) * (fahrenheit - 32)
print('{:.2} degrees Fahrenheit is {:.2} degrees Celsius.'.format(str(fahrenheit), str(celsius)))
def celsius_to_Fahrenheit():
celsius = float(input('Please enter the temperature in Celsius: '))
fahrenheit = 32 + (celsius * (9/5.0))
print('{:.2} degrees Celsius is {:.2} degrees Fahrenheit.'.format(str(celsius), str(fahrenheit)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment