fork(1) download
  1.  
  2. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
  3. # #
  4. # instruction:
  5. # first input: activaion code
  6. # second input: current holding value
  7. #
  8. # activaton codes:
  9. # Converts Degree Celcius to Kelvin in input: 1
  10. # Converts kelvin to degree celcius: 2
  11. # Converts degree celcius to Farenheit : 3
  12. # Converts Farenheit to kelvin: 4
  13. #
  14. #
  15. # eg: stdin: 1
  16. # 45
  17. # here 45°C converts to 318.15 K
  18. #
  19. # #
  20. # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. print("Which one you need\n Celcius to kelvin (1),\n kelvin to Celcius(2)\n Celcius to Farenheit(3)\n Farenheit to kelvin(4) \n\"Type the associated number to run required function\"")
  28. math= input()
  29. if (math=="1"):
  30. print(" Degree Celsius to Kelvin calc")
  31. dc_k = float(input(" Degree Celsius:"))
  32. kfrdc= dc_k+273.15 #Kelvin from celcius
  33. print("\n In kelvin :")
  34. print(kfrdc)
  35. if (math=="2"):
  36. print(" Kelvin to Degree Celcius calc")
  37. k_dc =float(input(" Kelvin:"))
  38. dc_frk= k_dc-273.15 #celcius from kelvin
  39. print("\n In celcius:")
  40. print(dc_frk)
  41. if (math=="3"):
  42. print(" Degree Celcius to Farenheit calc") #(1°C × 9/5) + 32 = 33.8°F
  43. dc_df = float(input("Degree Celsius:"))
  44. df_frdc= (dc_df*9/5)+32 #farenheit from celcius
  45. print("\n In farenheit :")
  46. print(df_frdc)
  47. if (math=="4"):
  48. print(" Farenheit to Degree celcius calc")
  49. df_dc = float(input(" Farenheit: "))
  50. dc_frdf =(df_dc-32)*5/9 # Celcius from farenheit
  51. print("\n In farenheit:")
  52. print(dc_frdf)
Success #stdin #stdout 0.02s 9204KB
stdin
2
456
stdout
Which one you need
 Celcius to kelvin (1),
 kelvin to Celcius(2)
 Celcius to Farenheit(3)
 Farenheit to kelvin(4) 
"Type the associated number to run required function"
 Kelvin to Degree Celcius calc
 Kelvin:
 In celcius:
182.85000000000002