Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import sys
- import time
- #Digunakan untuk membersihkan hasil output yang telah divalidasi
- def set_close():
- os.system('cls' if os.name == 'nt'else 'close')
- def set_aclose():
- print('\n')
- input('Error Input - Enter For Tryagain !')
- set_close()
- def exit():
- input('Thx For Use - Enter for exit')
- set_close()
- sys.exit()
- def exit00():
- input('Enter for Back')
- set_close()
- #pilihan menu konversi
- def home():
- print('\n')
- print(' Konversi Suhu '.center(50,'—'))
- print('| CELCIUS | REAMUR | KELVIN | FARENHEIT |')
- print('—'*(50))
- print('|celcius = C |reamur = R|Kelvin = K|Farenheit = F|'.center(50))
- print(' 0. Exit --- 00. About '.center(50,'—'))
- tanya = input('[C|R|K|F]~Input Menu :')
- if tanya == 'c' or tanya == 'C':
- tokyo_C()
- elif tanya == 'R' or tanya == 'r':
- tokyo_R()
- elif tanya == 'K' or tanya == 'k':
- tokyo_K()
- elif tanya == 'F' or tanya == 'f':
- tokyo_F()
- elif tanya == '00' or tanya == 'about':
- tokyo_about()
- elif tanya == '0' or tanya == 'exit':
- exit()
- else:
- set_aclose()
- home()
- #konversi suhu celcius
- def tokyo_C():
- tanya_c = input('Next [N] . Back [B] : ')
- if tanya_c == 'n' or tanya_c == 'N':
- set_close()
- tanya_c0 = float(input('Masukkan Suhu [°C] : '))
- reamur = 4/5*tanya_c0
- kelvin = tanya_c0+273
- farenheit = 9/5*tanya_c0+32
- #Hasil konversi celcius
- print(tanya_c0,'°C : ','{:.1f}'.format(reamur),'°R')
- print(tanya_c0,'°C : ','{:.1f}'.format(kelvin),'°K')
- print(tanya_c0,'°C : ','{:.1f}'.format(farenheit),' °F')
- return tokyo_C()
- elif tanya_c == 'b' or tanya_c == 'B':
- set_close()
- home()
- else:
- set_aclose()
- tokyo_C()
- #konversi suhu reamur
- def tokyo_R():
- tanya_r = input('Next [N] . Back [B] : ')
- if tanya_r == 'n' or tanya_r == 'N':
- set_close()
- tanya_r0 = float(input('Masukkan Suhu [°R] : '))
- celcius = 5/4*tanya_r0
- kelvin = (5/4*tanya_r0)+273
- farenheit = (9/4*tanya_r0)+32
- #Hasil konversi celcius
- print(tanya_r0,'°R : ','{:.1f}'.format(celcius),'°C')
- print(tanya_r0,'°R : ','{:.1f}'.format(kelvin),'°K')
- print(tanya_r0,'°R : ','{:.1f}'.format(farenheit),' °F')
- return tokyo_R()
- elif tanya_r == 'b' or tanya_r == 'B':
- set_close()
- home()
- else:
- set_aclose()
- tokyo_R()
- #Konversi Suhu Kelvin
- def tokyo_K():
- tanya_K = input('Next [N] . Back [B] : ')
- if tanya_K == 'n' or tanya_K == 'N':
- set_close()
- tanya_K0 = float(input('Masukkan Suhu [°K] : '))
- reamur = 4/5*(tanya_K0-273)
- celcius = ((tanya_K0-273.15)*9/5)+32
- farenheit = 9/5*tanya_K0+32
- #Hasil konversi celcius
- print(tanya_K0,'°K : ','{:.1f}'.format(reamur),'°R')
- print(tanya_K0,'°K : ','{:.1f}'.format(celcius),'°K')
- print(tanya_K0,'°K : ','{:.1f}'.format(farenheit),' °F')
- return tokyo_K()
- elif tanya_K == 'b' or tanya_K == 'B':
- set_close()
- home()
- else:
- set_aclose()
- tokyo_K
- #konversi suhu farenheit
- def tokyo_F():
- tanya_f = input('Next [N] . Back [B] : ')
- if tanya_f == 'n' or tanya_f == 'N':
- set_close()
- tanya_f0 = float(input('Masukkan Suhu [°F] : '))
- reamur = 4/9*(tanya_f0-32)
- kelvin = tanya_f0+273
- celcius = (tanya_f0-32)*5/9+273
- #Hasil konversi celcius
- print(tanya_f0,'°F : ','{:.1f}'.format(reamur),'°R')
- print(tanya_f0,'°F : ','{:.1f}'.format(kelvin),'°K')
- print(tanya_f0,'°F : ','{:.1f}'.format(celcius),' °C')
- return tokyo_F()
- elif tanya_f == 'b' or tanya_f == 'B':
- set_close()
- home()
- else:
- set_aclose()
- tokyo_F()
- #tentang/about pada kode
- def tokyo_about():
- set_close()
- print(' Version Beta-1.0.0 '.center(50))
- print(' Author : Kelompok Tokyo 0'.center(50))
- print('27 Oktober 2023,Sumatera Utara,Indonesia'.center(50))
- print('-'*(50))
- print('Alfan Nugraha Panjaitan @Ketua'.center(50))
- print('Sri May Silpi @anggota'.center(50))
- print('Marni Pane @anggota'.center(50))
- print('Rifski Ardiansyah @anggota'.center(50))
- print('Nurul Hidayani @anggota'.center(50))
- print('-'*(50))
- exit00()
- home()
- #memanggil fungsi home
- home()
Advertisement
Add Comment
Please, Sign In to add comment