Oct-02-2016, 03:39 AM
I'm not exactly understanding your conversion methods, but this is how I would do it:
print("K for kelvin, C for Celsius, F for Fahrenheit ") option = None while not option in ['c', 'f', 'k']: option = input("Enter Selection: ").lower() temp = float(input("Input Temperature in {}: ".format(option.upper()))) conversions = dict(kelvin=None, celsius=None, fahrenheit=None) if option == 'k': conversions.update([('celsius', temp-273.16), ('fahrenheit', (temp+273.16)*(9/5)+32), ('kelvin', temp)]) elif option == 'c': conversions.update([('celsius', temp), ('fahrenheit', temp*(9/5)+32), ('kelvin', temp+273.16)]) elif option == 'f': conversions.update([('celsius', (temp-32)*(5/9)), ('fahrenheit', temp), ('kelvin', (temp-32)*(5/9)+273.16)]) print(conversions)