ANPstore

Konversi Suhu

Nov 2nd, 2023
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 13.00 KB | Software | 0 0
  1. #We hope that users of this script will not change the owner's name or declare themselves to be the owner
  2. #based on Article 40 paragraph (1) letter s of Law Number 28 of 2014 concerning Copyright ("Copyright Law")
  3. #This script was created without copying someone else's, please provide proof of license if you own the script!
  4. #//@AlfanNPstore.co // Thx For God // Thx For Python . Program sederhana v1.0.0.tokyo (T)KS01-tokyo
  5.  
  6. #Module
  7. from time import sleep
  8. import sys
  9. import random
  10. import time
  11. #HEADER
  12. print(' Hello, We are From the TOKYO Group '.center(50,'—'))
  13. print('version : 1.0.0.tokyo | type : KS01-tokyo'.center(50))
  14.  
  15.  
  16. #\\Menu utama
  17. def home():
  18.     print('\n')
  19.     print(' Konversi Suhu '.center(50,'—'))
  20.     print('celcius = C reamur = R Kelvin = K Farenheit = F'.center(50))
  21.     print('—'*(50))
  22.     print('|   CELCIUS  |  REAMUR  |  KELVIN  |  FARENHEIT  |')
  23.     print(' 0. about '.center(50,'—'))
  24.    
  25.     tanya = input('input menu[C|R|K|F] - Out [X] \n»')
  26.  
  27.     if tanya == 'c' or tanya == 'C':
  28.         tokyo_C()
  29.     elif tanya == 'R' or tanya == 'r':
  30.         tokyo_R()
  31.     elif tanya == 'K' or tanya == 'k':
  32.         tokyo_K()
  33.     elif tanya == 'F' or tanya == 'f':
  34.         tokyo_F()
  35.     elif tanya == '0' or tanya == 'about':
  36.         tokyo_about()
  37.     elif tanya == 'x' or tanya == 'X':
  38.         print('(Out) Sampai Jumpa Lagi :> ')
  39.         sys.exit()
  40.     else:
  41.         tokyo_error()
  42.         home()
  43.        
  44. #AlfanNPstore.co
  45. #eceknya wm
  46. def tokyo_about():
  47.     print('\n')
  48.     print('—'*(35))
  49.     print('|        KELOMPOK : TOKYO          |')
  50.     print('—'*(35))
  51.     print('|  MARNI PANE SITORUS     |[ANGGOTA]')
  52.     print('|  ALFAN NUGRAHA PANJAITAN|[ KETUA ]')
  53.     print('|  SRI MAY SILPI          |[ANGGOTA]')
  54.     print('|  NURUL HIDAYANI         |[ANGGOTA]')
  55.     print('|  RIFSKI ARDIANSYAH      |[ANGGOTA]')
  56.     print('—'*(36))
  57.     tokyo_watermark()
  58.     tokyo_quest()
  59.  
  60. #MENU NEXT OR NO
  61. #\\AlfanNPstore.co
  62. def tokyo_quest():
  63.     print('\n')
  64.     go = input('[Y]HOME | [T]OUT » ')
  65.    
  66.     if go == 'y' or go == 'Y':
  67.         home()
  68.     elif go == 't' or go == 'T':
  69.         print('(OUT) Sampai Jumpa Lagi :> ')
  70.         sys.exit()
  71.     else:
  72.         tokyo_quest()
  73.        
  74. #Teks berjalan
  75. #\\Kelompok Tokyo
  76. def tokyo_watermark():
  77.     eceknya = 'Projek simple yang dibuat oleh,-\n'
  78.     thx = 'kelompok TOKYO di Kelas IF-C sore '
  79.  
  80.     for c in eceknya+thx:
  81.         sys.stdout.write(c)
  82.         sys.stdout.flush()
  83.         time.sleep(random.random()*0.1)
  84.  
  85.        
  86. #\\Error teks
  87. def tokyo_error():
  88.     error = '[TOKYO] Menu NotFound - TryAgain !'
  89.     for c in error:
  90.         sys.stdout.write(c)
  91.         sys.stdout.flush()
  92.         time.sleep(random.random()*0.1)
  93.    
  94.    
  95. ###MENU
  96. #\\disini menu konversi celcius
  97. def tokyo_C():
  98.     print('\n')
  99.     print(' Konversi Celcius '.center(50,'—'))
  100.     print(' 1. Reamur  2. Kelvin  3. Farenheit '.center(50))
  101.     tc = input('Konversi Ke [1|2|3] - Back [B]\n»»» ')
  102.     print('-'*(50))
  103.  
  104.     if tc == '1':
  105.         tanya1()
  106.     elif tc == '2':
  107.         tanya2()
  108.     elif tc == '3':
  109.         tanya3()
  110.     elif tc == 'B' or tc == 'b':
  111.         home()
  112.     else:
  113.         tokyo_error()
  114.         tokyo_C()
  115.  
  116. #\\disini menu konversi reamur
  117. def tokyo_R():
  118.     print('\n')
  119.     print(' Konversi Reamur '.center(50,'—'))
  120.     print(' 1. Celcius  2. Kelvin  3. Faren#heit '.center(50))
  121.     tr = input('Konversi Ke [1|2|3] - Back [B]\n»»» ')
  122.     print('-'*(50))
  123.  
  124.     if tr == '1':
  125.         tanya4()
  126.     elif tr == '2':
  127.         tanya5()
  128.     elif tr == '3':
  129.         tanya6()
  130.     elif tr == 'B' or tr == 'b':
  131.         home()
  132.     else:
  133.         tokyo_error()
  134.         tokyo_R()
  135.  
  136. #\\disini menu konversi kelvin
  137. def tokyo_K():
  138.     print('\n')
  139.     print(' Konversi Kelvin '.center(50,'—'))
  140.     print(' 1. Reamur  2. Celcius  3. Farenheit '.center(50))
  141.     tc = input('Konversi Ke [1|2|3] - Back [B]\n»»» ')
  142.     print('-'*(50))
  143.  
  144.     if tc == '1':
  145.         tanya8()
  146.     elif tc == '2':
  147.         tanya7()
  148.     elif tc == '3':
  149.         tanya9()
  150.     elif tc == 'B' or tc == 'b':
  151.         home()
  152.     else:
  153.         tokyo_error()
  154.         tokyo_K()
  155.  
  156. #\\disini menu konversi farenheit
  157. def tokyo_F():
  158.     print('\n')
  159.     print(' Konversi Farenheit '.center(50,'—'))
  160.     print(' 1. Reamur  2. Kelvin  3. Celcius '.center(50))
  161.     tc = input('Konversi Ke [1|2|3] - Back [B]\n»»» ')
  162.     print('-'*(50))
  163.  
  164.     if tc == '1':
  165.         tanya10()
  166.     elif tc == '2':
  167.         tanya12()
  168.     elif tc == '3':
  169.         tanya11()
  170.     elif tc == 'B' or tc == 'b':
  171.         home()
  172.     else:
  173.         tokyo_error()
  174.         tokyo_F()
  175.  
  176. #\\Konversi celcius
  177. #\Celcius - reamur
  178. def tanya1():
  179.     xv = input('[N]Next | [C]Change     » ')
  180.     if xv == 'N' or xv == 'n':
  181.         tokyo_celcius1()
  182.     elif xv == 'C' or xv == 'c':
  183.         txv = input('Celcius Konversi  [K|F] » ')
  184.         if txv == 'K' or txv == 'k':
  185.             tokyo_celcius2()
  186.         elif txv == 'F' or txv == 'f':
  187.             tokyo_celcius3()
  188.     else:
  189.             tokyo_error()
  190.             print('\n')
  191.             tanya1()
  192. def tokyo_celcius1():
  193.     print('\n')
  194.     print('[+] Celcius - Reamur')
  195.     celcius1 = float(input('Masukkan Suhu[°C]\t     : '))
  196.     reamur1 = 4/5*celcius1
  197.     print('Hasil[°R]\t\t     : {:.1f}'.format(reamur1))
  198.     tokyo_quest()
  199.  
  200. #Celcius - Kelvin
  201. def tanya2():
  202.     xv = input('[N]Next | [C]Change     » ')
  203.     if xv == 'N' or xv == 'n':
  204.         tokyo_celcius2()
  205.     elif xv == 'C' or xv == 'c':
  206.         txv = input('Celcius Konversi  [C|F] » ')
  207.         if txv == 'C' or txv == 'c':
  208.             tokyo_celcius1()
  209.         elif txv == 'F' or txv == 'f':
  210.             tokyo_celcius3()
  211.     else:
  212.             tokyo_error()
  213.             print('\n')
  214.             tanya2()
  215. def tokyo_celcius2():
  216.     print('\n')
  217.     print(' Celcius - Kelvin '.center(50))
  218.     celcius2 = float(input('Masukkan Suhu[°C] : '))
  219.     kelvin1 = 273+celcius2
  220.     print('Hasil[°K] : {:.1f}'.format(kelvin1))
  221.     tokyo_quest()
  222.  
  223. #\Celcius - Farenheit
  224. def tanya3():
  225.     xv = input('[N]Next | [C]Change     » ')
  226.     if xv == 'N' or xv == 'n':
  227.         tokyo_celcius3()
  228.     elif xv == 'C' or xv == 'c':
  229.         txv = input('Celcius Konversi  [K|R] » ')
  230.         if txv == 'K' or txv == 'k':
  231.             tokyo_celcius2()
  232.         elif txv == 'R' or txv == 'r':
  233.             tokyo_celcius1()
  234.     else:
  235.             tokyo_error()
  236.             print('\n')
  237.             tanya3()
  238. def tokyo_celcius3():
  239.     print('\n')
  240.     print(' Celcius - Farenheit '.center(50))
  241.     celcius3 = float(input('Masukkan Suhu[°C] : '))
  242.     farenheit1 = 9/5*celcius3+32
  243.     print('Hasil[°F] : {:.1f}'.format(farenheit1))
  244.     tokyo_quest()
  245.  
  246. #\\konversi reamur
  247. #\reamur - celcius
  248. def tanya4():
  249.     xv = input('[N]Next | [C]Change     » ')
  250.     if xv == 'N' or xv == 'n':
  251.         tokyo_reamur1()
  252.     elif xv == 'C' or xv == 'c':
  253.         txv = input('Reamur Konversi  [K|F] » ')
  254.         if txv == 'K' or txv == 'k':
  255.             tokyo_reamur2()
  256.         elif txv == 'F' or txv == 'f':
  257.             tokyo_reamur3()
  258.     else:
  259.             tokyo_error()
  260.             print('\n')
  261.             tanya4()
  262. def tokyo_reamur1():
  263.     print('\n')
  264.     print('[+] Reamur - Celcius')
  265.     reamur1 = float(input('Masukkan Suhu[°R]\t     : '))
  266.     celcius4 = 5/4*reamur1
  267.     print('Hasil[°C]\t\t     : {:.1f}'.format(celcius4))
  268.     tokyo_quest()
  269.  
  270. #\reamur - kelvin
  271. def tanya5():
  272.     xv = input('[N]Next | [C]Change     » ')
  273.     if xv == 'N' or xv == 'n':
  274.         tokyo_reamur2()
  275.     elif xv == 'C' or xv == 'c':
  276.         txv = input('Reamur Konversi  [C|F] » ')
  277.         if txv == 'C' or txv == 'c':
  278.             tokyo_reamur1()
  279.         elif txv == 'F' or txv == 'f':
  280.             tokyo_reamur3()
  281.     else:
  282.             tokyo_error()
  283.             print('\n')
  284.             tanya5()
  285. def tokyo_reamur2():
  286.     print('\n')
  287.     print('[+] Reamur - Kelvin ')
  288.     reamur2 = float(input('Masukkan Suhu[°R]\t     : '))
  289.     kelvin2 = (5/4*reamur2)+273
  290.     print('Hasil[°K]\t\t     : {:.1f}'.format(kelvin2))
  291.     tokyo_quest()
  292.    
  293. #\reamur - farenheit
  294. def tanya6():
  295.     xv = input('[N]Next | [C]Change     » ')
  296.     if xv == 'N' or xv == 'n':
  297.         tokyo_reamur3()
  298.     elif xv == 'C' or xv == 'c':
  299.         txv = input('Reamur Konversi  [K|C] » ')
  300.         if txv == 'K' or txv == 'k':
  301.             tokyo_reamur1()
  302.         elif txv == 'C' or txv == 'c':
  303.             tokyo_reamur1()
  304.     else:
  305.             tokyo_error()
  306.             print('\n')
  307.             tanya6()
  308. def tokyo_reamur3():
  309.     print('\n')
  310.     print('[+] Reamur - Farenheit')
  311.     reamur3 = float(input('Masukkan Suhu[°R]\t     : '))
  312.     fahrenheit2 = (9/4*reamur3)+32
  313.     print('Hasil[°F]\t\t     : {:.1f}'.format(fahrenheit2))
  314.     tokyo_quest()
  315.    
  316.    
  317. #\\konversi kelvin
  318. #\kelvin - celcius
  319. def tanya7():
  320.     xv = input('[N]Next | [C]Change     » ')
  321.     if xv == 'N' or xv == 'n':
  322.         tokyo_kelvin1()
  323.     elif xv == 'C' or xv == 'c':
  324.         txv = input('Kelvin Konversi  [R|F] » ')
  325.         if txv == 'R' or txv == 'r':
  326.             tokyo_kelvin2()
  327.         elif txv == 'F' or txv == 'f':
  328.             tokyo_kelvin3()
  329.     else:
  330.             tokyo_error()
  331.             print('\n')
  332.             tanya7()
  333. def tokyo_kelvin1():
  334.     print('\n')
  335.     print('[+] Kelvin - Celcius')
  336.     kelvin3 = float(input('Masukkan Suhu[°K]\t     : '))
  337.     celcius5 = kelvin3-273.15
  338.     print('Hasil[°C]\t\t     : {:.1f}'.format(celcius5))
  339.     tokyo_quest()
  340.    
  341. #\kelvin - reamur
  342. def tanya8():
  343.     xv = input('[N]Next | [C]Change     » ')
  344.     if xv == 'N' or xv == 'n':
  345.         tokyo_kelvin2()
  346.     elif xv == 'C' or xv == 'c':
  347.         txv = input('Kelvin Konversi  [C|F] » ')
  348.         if txv == 'C' or txv == 'c':
  349.             tokyo_kelvin1()
  350.         elif txv == 'F' or txv == 'f':
  351.             tokyo_kelvin3()
  352.     else:
  353.             tokyo_error()
  354.             print('\n')
  355.             tanya8()
  356. def tokyo_kelvin2():
  357.     print('\n')
  358.     print('[+] Kelvin - Reamur')
  359.     kelvin4 = float(input('Masukkan Suhu[°K]\t     : '))
  360.     reamur4 = 4/5*(kelvin4-273)
  361.     print('Hasil[°R]\t\t     : {:.1f}'.format(reamur4))
  362.     tokyo_quest()
  363.    
  364. #\kelvin - fahrenheit
  365. def tanya9():
  366.     xv = input('[N]Next | [C]Change     » ')
  367.     if xv == 'N' or xv == 'n':
  368.         tokyo_kelvin3()
  369.     elif xv == 'C' or xv == 'c':
  370.         txv = input('Kelvin Konversi  [R|C] » ')
  371.         if txv == 'R' or txv == 'r':
  372.             tokyo_kelvin1()
  373.         elif txv == 'C' or txv == 'c':
  374.             tokyo_kelvin2()
  375.     else:
  376.             tokyo_error()
  377.             print('\n')
  378.             tanya9()
  379. def tokyo_kelvin3():
  380.     print('\n')
  381.     print('[+] Kelvin - Fahrenheit')
  382.     kelvin5 = float(input('Masukkan Suhu[°K]\t     : '))
  383.     fahrenheit3 = ((kelvin5-273.15)*9/5)+32
  384.     print('Hasil[°F]\t\t     : {:.1f}'.format(fahrenheit3))
  385.     tokyo_quest()
  386.    
  387. #\\konversi fahrenheit
  388. #\fahrenheit - reamur
  389. def tanya10():
  390.     xv = input('[N]Next | [C]Change     » ')
  391.     if xv == 'N' or xv == 'n':
  392.         tokyo_fahrenheit1()
  393.     elif xv == 'C' or xv == 'c':
  394.         txv = input('Fahrenheit Konversi  [C|K] » ')
  395.         if txv == 'C' or txv == 'c':
  396.             tokyo_fahrenheit2()
  397.         elif txv == 'F' or txv == 'f':
  398.             tokyo_fahrenheit3()
  399.     else:
  400.             tokyo_error()
  401.             print('\n')
  402.             tanya10()
  403. def tokyo_fahrenheit1():
  404.     print('\n')
  405.     print('[+] Fahrenheit - Reamur')
  406.     fahrenheit4 = float(input('Masukkan Suhu[°F]\t     : '))
  407.     reamur6 = 4/9*(fahrenheit4-32)
  408.     print('Hasil[°R]\t\t     : {:.1f}'.format(reamur6))
  409.     tokyo_quest()
  410.    
  411. #\fahrenheit - celcius
  412. def tanya11():
  413.     xv = input('[N]Next | [C]Change     » ')
  414.     if xv == 'N' or xv == 'n':
  415.         tokyo_fahrenheit2()
  416.     elif xv == 'C' or xv == 'c':
  417.         txv = input('Fahrenheit Konversi  [R|K] » ')
  418.         if txv == 'R' or txv == 'r':
  419.             tokyo_fahrenheit1()
  420.         elif txv == 'K' or txv == 'k':
  421.             tokyo_fahrenheit3()
  422.     else:
  423.             tokyo_error()
  424.             print('\n')
  425.             tanya11()
  426. def tokyo_fahrenheit2():
  427.     print('\n')
  428.     print('[+] Fahrenheit - Celcius')
  429.     fahrenheit5 = float(input('Masukkan Suhu[°F]\t     : '))
  430.     celcius6 = (fahrenheit5-32)*5/9
  431.     print('Hasil[°C]\t\t     : {:.1f}'.format(celcius6))
  432.     tokyo_quest()
  433.    
  434. #\fahrenheit - kelvin
  435. def tanya12():
  436.     xv = input('[N]Next | [C]Change     » ')
  437.     if xv == 'N' or xv == 'n':
  438.         tokyo_fahrenheit3()
  439.     elif xv == 'C' or xv == 'c':
  440.         txv = input('Fahrenheit Konversi  [C|R] » ')
  441.         if txv == 'C' or txv == 'c':
  442.             tokyo_fahrenheit2()
  443.         elif txv == 'R' or txv == 'r':
  444.             tokyo_fahrenheit1()
  445.     else:
  446.             tokyo_error()
  447.             print('\n')
  448.             tanya12()
  449. def tokyo_fahrenheit3():
  450.     print('\n')
  451.     print('[+] Fahrenheit - Kelvin')
  452.     fahrenheit6 = float(input('Masukkan Suhu[°F]\t     : '))
  453.     kelvin6 = (fahrenheit6-32)*5/9+273
  454.     print('Hasil[°K]\t\t     : {:.1f}'.format(kelvin6))
  455.     tokyo_quest()
  456.  
  457. #\\memanggil fungsi menu home
  458. home()
  459.  
Advertisement
Add Comment
Please, Sign In to add comment