Description:
This is a very simple temperature converter using Python 3.3.2. It uses the command prompt, similar to Visual Basic.Net's console application.


Notes:
You can easily convert this to compile with Python 2, just change input() to raw_input()


Plans:
I plan to properly parse the numeric datatypes. Currently I'm just using int([string]), which is fine if the user enters in a numeric data type, but if the user enters in a non-numeric character then it will crash the program.


Source:
Python Code:
  1. #The Fahrenheit to Celsius and Vice-Versa Functions
  2. def f_to_c(f):
  3.     return (f - 32) * 5 / 9
  4.    
  5. def c_to_f(c):
  6.     return c * 9 / 5 + 32
  7.    
  8. main = True
  9. while main == True:
  10.     val = int(input("Please enter in the degrees you wish to convert: "))
  11.     #This prints out:
  12.     #Which would you like to do?
  13.     #Convert Fahrenheit to Celsius: 1
  14.     #Convert Celsius to Fahrenheit: 2
  15.     #
  16.     #
  17.     response = input("Which would you like to do?\nConvert Fahrenheit to Celsius: 1\nConvert Celsius to Fahrenheit: 2\n\n")
  18.    
  19.     valid = False
  20.     while valid == False:
  21.         if response == "1":
  22.             c = f_to_c(val)
  23.             valid = True
  24.             print (str(val) + " degrees Fahrenheit is " + str(c) + " degrees Celsius\n")
  25.         elif response == "2":
  26.             f = c_to_f(val)
  27.             valid = True
  28.             print (str(val) + " degrees Celsius is " + str(f) + " degrees Fahrenheit\n")
  29.         else:
  30.             print ("Invalid Input")