Advertisement
VergeoPaw

Suhu - Vergeo

Sep 3rd, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.46 KB | None | 0 0
  1. #####################################
  2. #             TUGAS SUHU            #
  3. # Nama  : Vergeo Valentino Gunawan  #
  4. # Kelas : IX.I (9.1)                #
  5. #####################################
  6. print("------------------------------------")
  7. print("TUGAS SUHU")
  8. print("Nama \t: Vergeo Valentino Gunawan")
  9. print("Kelas\t: IX.I(9.1)")
  10. print("------------------------------------")
  11. print("")
  12. print("------------------------------------")
  13.  
  14. def _celcius_to_reamur(Celcius) :
  15.     reamur = (4 * Celcius)/5
  16.     return reamur
  17.  
  18. def _celcius_to_farenheit(Celcius):
  19.     farenheit = ((9 * Celcius)/5) + 32
  20.     return farenheit
  21.  
  22. def _celcius_to_kelvin(Celcius) :
  23.     kelvin = (Celcius) + 273
  24.     return kelvin
  25.  
  26. def _reamur_to_celcius(Reamur):
  27.     celcius = (Reamur * 5)/4
  28.     return celcius
  29.  
  30. def _reamur_to_farenheit(Reamur):
  31.     farenheit = ((Reamur * 9)/4) + 32
  32.     return farenheit
  33.  
  34. def _reamur_to_kelvin(Reamur):
  35.     kelvin = ((Reamur * 5)/4) + 273
  36.     return kelvin
  37.  
  38. def _farenheit_to_celcius(Farenheit):
  39.     celcius = ((Farenheit - 32) * 5)/9
  40.     return celcius
  41.  
  42. def _farenheit_to_reamur(Farenheit):
  43.     reamur = ((Farenheit -32)* 4)/9
  44.     return reamur
  45.  
  46. def _farenheit_to_kelvin(Farenheit):
  47.     kelvin = (((Farenheit -32) * 5)/9) + 273
  48.     return kelvin
  49.  
  50. def _kelvin_to_celcius(Kelvin):
  51.     celcius = (Kelvin - 273)
  52.     return celcius
  53.  
  54. def _kelvin_to_reamur(Kelvin):
  55.     reamur = ((Kelvin -273)* 4)/5
  56.     return reamur
  57.  
  58. def _kelvin_to_farenheit(Kelvin):
  59.     farenheit = (((Kelvin-273)*9)/5)+32
  60.     return farenheit
  61.  
  62.  
  63.  
  64. C = float(input("Masukkan suhu : "))
  65. print("Pilih mau diubah ke mana ?")
  66. print("[1] C -> R\t[4] R -> C\t[7] F -> C\t[10] K -> C")
  67. print("[2] C -> F\t[5] R -> F\t[8] F -> R\t[11] K -> R")
  68. print("[3] C -> K\t[6] R -> K\t[9] F -> K\t[12] K -> F")
  69. pilihan = input("Pilihan kamu :")
  70.  
  71. if pilihan == "1" :
  72.     hasil = _celcius_to_reamur(C)
  73. elif pilihan == "2" :
  74.     hasil = _celcius_to_farenheit(C)
  75. elif pilihan == "3" :
  76.     hasil = _celcius_to_kelvin(C)
  77. elif pilihan == "4" :
  78.     hasil = _reamur_to_celcius(C)
  79. elif pilihan == "5" :
  80.     hasil = _reamur_to_farenheit(C)
  81. elif pilihan == "6" :
  82.     hasil = _reamur_to_kelvin(C)
  83. elif pilihan == "7" :
  84.     hasil = _farenheit_to_celcius(C)
  85. elif pilihan == "8" :
  86.     hasil = _farenheit_to_reamur(C)
  87. elif pilihan == "9" :
  88.     hasil = _farenheit_to_kelvin(C)
  89. elif pilihan == "10" :
  90.     hasil = _kelvin_to_celcius(C)
  91. elif pilihan == "11" :
  92.     hasil = _kelvin_to_reamur(C)
  93. elif pilihan == "12" :
  94.     hasil = _kelvin_to_farenheit(C)
  95.  
  96.  
  97. print("Jadi haislnya %.2f" % (hasil))
  98.  
  99. print("------------------------------------")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement