-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprogram_sederhana_tentang_konversi_suhu.py
90 lines (77 loc) · 2.21 KB
/
program_sederhana_tentang_konversi_suhu.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
'''
!!catatan!!
Buat lah program sederhana konversi suhu dengan
menggunakan bahasa pemograman Python. Dengan kriteria
1. Fahrenheit ke Celsius
2. Kelvin ke Celsius
3. Reamur ke Celsius
Gunakan Variabel dan operasi Aritmatika
!!poin plus!!
Memiliki Menu tampilan (Ada Pilihan Keluar dan menghitung kembali)
'''
from judul_menu_konversi_suhu import judul, menu, exit
#fahrenheit ke celcius
def fahrenheit():
print('\nMengkonversi Fahrenheit ke Celcius')
print('--------------------------------')
suhu = float(input("Masukkan suhu awal: "))
F = ((9 * suhu)/ 5 + 32)
print(suhu,"F", "=", F,"C")
pilihan = str(input('\n(yes/no)\nIngin menghitung kembali? \n'))
if pilihan == "yes":
judul()
menu()
pil = int(input("Masukkan Pilihan: "))
if pil == 2:
kelvin()
elif pil == 3:
reamur()
elif pilihan == "no":
exit()
#kelvin ke celcius
def kelvin():
print("\nMengkonversi Kelvin ke Celcius")
print("------------------------------")
suhu = float(input("Masukkan suhu awal: "))
K = (suhu + 273.15)
print(suhu,"K", "=", K,"C")
pilihan = str(input('\n(yes/no)\nIngin menghitung kembali? \n'))
if pilihan == ("yes"):
judul()
menu()
pil = int(input("Masukkan Pilihan: "))
if pil == 1:
fahrenheit()
elif pil == 3:
reamur()
elif pilihan == ("no"):
exit()
#reamur ke celcius
def reamur():
print('\nMengkonversi Reamur Ke Celcius')
print('--------------------------------')
suhu = float(input("Masukkan suhu awal: "))
R = ((5/4) * suhu)
print(suhu,"R", "=", R,"C")
pilihan = str(input('\n(yes/no)\nIngin menghitung kembali? \n'))
if pilihan == ("yes"):
judul()
menu()
pil = int(input("Masukkan Pilihan: "))
if pil == 1:
fahrenheit()
elif pil == 2:
kelvin()
elif pilihan == ("no"):
exit()
judul()
menu()
pill = int(input("contoh > 1/2/3\nMasukkan Pilihan: "))
if pill == 1:
fahrenheit()
elif pill == 2:
kelvin()
elif pill == 3:
reamur()
else:
exit()