Make your own free website on Tripod.com

KIMIA PENGKOMPUTAN

PenGaTurCaraaN

Home | GluKosa | MoLekuL GlukOSa | PeNGiraaN GluKoSa | PenGaTurCaraaN | RuJUkaN

Dengan menggunakan Python, kami telah mengaturcarakan satu program untuk mengetahui nombor atom, jisim atom relatif, simbol serta nama penuh bagi sesuatu unsur.
 
Di bawah ini adalah program yang telah dibina ;

PROGRAMMING

 

#Program ini adalah untuk membaca 30 unsur pertama jadual berkala serta sifat-sifatnya.

 

#Penggunaan list sebagai database.

 

Simbol=["H","Hidrogen",1,1.008,0.071,-259,-252,1310,"He","Helium",2,4.003,0.15,-270,-269,2370,

        "Li","Litium",3,6.939,0.53,180,1330,519,"Be","Berilium",4,9.012,1.85,1277,2477,900,

        "B","Boron",5,10.81,2.34,2300,3930,799,"C","Karbon",6,12.01,2.26,3730,4830,1090,

        "N","Nitrogen",7,14.00,0.81,-210,-196,1400,"O","Oksigen",8,16.00,1.14,-219,-183,1310,

        "F","Flourin",9,19.00,1.11,-219,-188,1680,"Ne","Neon",10,20.18,1.20,-249,-246,2080,

        "Na","Natrium",11,22.99,0.97,98,890,494,"Mg","Magnesium",12,24.31,1.74,650,1107,736,

        "Al","Aluminium",13,26.98,2.70,660,2450,577,"Si","Silikon",14,28.09,2.33,1410,2360,786,

        "P","Fosforus",15,30.97,1.82,44,280,1060,"S","Sulfur",16,32.06,2.07,113,445,1000,

        "Cl","Klorin",17,35.45,1.56,-101,-34.7,1260,"Ar","Argon",18,39.95,1.40,-189,-186,1520,

        "K","Kalium",19,39.10,0.86,63.7,760,418,"Ca","Kalsium",20,40.08,1.55,838,1480,590,

        "Sc","Skandium",21,44.96,3.0,1541,2730,632,"Ti","Titanium",22,47.90,4.51,1660,3260,661,

        "V","Vanadium",23,50.94,6.1,1900,3450,648,"Cr","Kromium",24,52.00,7.19,1875,2672,653,

        "Mn","Mangan",25,54.94,7.43,1244,2150,716,"Fe","Ferum",26,55.85,7.86,1535,3000,762,

        "Co","Kobalt",27,58.92,8.9,1495,2900,757,"Ni","Nikel",28,58.71,8.9,1453,2730,736,

        "Cu","Kuprum",29,63.54,8.96,1083,2595,745,"Zn","Zink",30,65.37,7.14,420,906,908]

 

Nama=["Hidrogen","H",1,1.008,0.071,-259,-252,1310,"Helium","He",2,4.003,0.15,-270,-269,2370,

        "Litium","Li",3,6.939,0.53,180,1330,519,"Berilium","Be",4,9.012,1.85,1277,2477,900,

        "Boron","B",5,10.81,2.34,2300,3930,799,"Karbon","C",6,12.01,2.26,3730,4830,1090,

        "Nitrogen","N",7,14.00,0.81,-210,-196,1400,"Oksigen","O",8,16.00,1.14,-219,-183,1310,

        "Flourin","F",9,19.00,1.11,-219,-188,1680,"Neon","Ne",10,20.18,1.20,-249,-246,2080,

        "Natrium","Na",11,22.99,0.97,98,890,494,"Magnesium","Mg",12,24.31,1.74,650,1107,736,

        "Aluminium","Al",13,26.98,2.70,660,2450,577,"Silikon","Si",14,28.09,2.33,1410,2360,786,

        "Fosforus","P",15,30.97,1.82,44,280,1060,"Sulfur","S",16,32.06,2.07,113,445,1000,

        "Klorin","Cl",17,35.45,1.56,-101,-34.7,1260,"Argon","Ar",18,39.95,1.40,-189,-186,1520,

        "Kalium","K",19,39.10,0.86,63.7,760,418,"Kalsium","Ca",20,40.08,1.55,838,1480,590,

        "Skandium","Sc",21,44.96,3.0,1541,2730,632,"Titanium","Ti",22,47.90,4.51,1660,3260,661,

        "Vanadium","V",23,50.94,6.1,1900,3450,648,"Kromium","Cr",24,52.00,7.19,1875,2672,653,

        "Mangan","Mn",25,54.94,7.43,1244,2150,716,"Ferum","Fe",26,55.85,7.86,1535,3000,762,

        "Kobalt","Co",27,58.92,8.9,1495,2900,757,"Nikel","Ni",28,58.71,8.9,1453,2730,736,

        "Kuprum","Cu",29,63.54,8.96,1083,2595,745,"Zink","Zn",30,65.37,7.14,420,906,908]

 

No_atom=["1","Hidrogen","H",1.008,0.071,-259,-252,1310,"2","Helium","He",4.003,0.15,-270,-269,2370,

        "3","Litium","Li",6.939,0.53,180,1330,519,"4","Berilium","Be",9.012,1.85,1277,2477,900,

        "5","Boron","B",10.81,2.34,2300,3930,799,"6","Karbon","C",12.01,2.26,3730,4830,1090,

        "7","Nitrogen","N",14.00,0.81,-210,-196,1400,"8","Oksigen","O",16.00,1.14,-219,-183,1310,

        "9","Flourin","F",19.00,1.11,-219,-188,1680,"10","Neon","Ne",20.18,1.20,-249,-246,2080,

        "11","Natrium","Na",22.99,0.97,98,890,494,"12","Magnesium","Mg",24.31,1.74,650,1107,736,

        "13","Aluminium","Al",26.98,2.70,660,2450,577,"14","Silikon","Si",28.09,2.33,1410,2360,786,

        "15","Fosforus","P",30.97,1.82,44,280,1060,"16","Sulfur","S",32.06,2.07,113,445,1000,

        "17","Klorin","Cl",35.45,1.56,-101,-34.7,1260,"18","Argon","Ar",39.95,1.40,-189,-186,1520,

        "19","Kalium","K",39.10,0.86,63.7,760,418,"20","Kalsium","Ca",40.08,1.55,838,1480,590,

        "21","Skandium","Sc",44.96,3.0,1541,2730,632,"22","Titanium","Ti",47.90,4.51,1660,3260,661,

        "23","Vanadium","V",50.94,6.1,1900,3450,648,"24","Kromium","Cr",52.00,7.19,1875,2672,653,

        "25","Mangan","Mn",54.94,7.43,1244,2150,716,"26","Ferum","Fe",55.85,7.86,1535,3000,762,

        "27","Kobalt","Co",58.92,8.9,1495,2900,757,"28","Nikel","Ni",58.71,8.9,1453,2730,736,

        "29","Kuprum","Cu",63.54,8.96,1083,2595,745,"30","Zink","Zn",65.37,7.14,420,906,908]

 

ok=1

while ok:

    print "Pilih masukkan yang anda kehendaki seperti berikut"

    x=int(raw_input("Masukkan 1 untuk Simbol unsur; 2 untuk Nama unsur; 3 untuk Nombor Atom unsur: "))

    if x==1:

        a=raw_input("Masukkan Simbol unsur yang anda kehendaki: ")

        if a in Simbol:

            num=Simbol.index(a)

            print "Nama Unsur = ",Simbol[num+1]

            print "Nombor Atom = ",Simbol[num+2]

            print "Jisim Atom Relatif (g/mol)= ",Simbol[num+3]

            print "Ketumpatan (g/cm-3)= ",Simbol[num+4]

            print "Takat Lebur (darjah Celcius) = ",Simbol[num+5]

            print "Takat Didih(darjah Celcius) = ",Simbol[num+6]

            print "Tenaga Pengionan Pertama(kJ/mol) = ",Simbol[num+7]

        else:

            print"Tiada maklumat"

       

    elif x==2:

        b=raw_input("Masukkan Nama unsur yang anda kehendaki: ")

        if b in Nama:

            num=Nama.index(b)

            print "Simbol Unsur = ",Nama[num+1]

            print "Nombor Atom = ",Nama[num+2]

            print "Jisim Atom Relatif(g/mol) = ",Nama[num+3]

            print "Ketumpatan (g/cm-3)= ",Nama[num+4]

            print "Takat Lebur(darjah Celcius) = ",Nama[num+5]

            print "Takat Didih (darjah Celcius)= ",Nama[num+6]

            print "Tenaga Pengionan Pertama(kJ/mol) = ",Nama[num+7]

        else:

            print "Tiada Maklumat"

    elif x==3:

        c=raw_input("Masukkan Nombor Atom yang anda kehendaki: ")

        if c in No_atom:

            num=No_atom.index(c)

            print "Nama Unsur = ",No_atom[num+1]

            print "Simbol Unsur = ",No_atom[num+2]

            print "Jisim Atom Relatif(g/mol) = ",No_atom[num+3]

            print "Ketumpatan (g/cm-3)= ",No_atom[num+4]

            print "Takat Lebur(darjah Celcius) = ",No_atom[num+5]

            print "Takat Didih(darjah Celcius) = ",No_atom[num+6]

            print "Tenaga Pengionan Pertama(kJ/mol) = ",No_atom[num+7]

        else:

            print "Tiada Maklumat"

    else:

        print "Maaf!Tiada Maklumat.."

    try:

        ok=int(raw_input("Enter 0 untuk keluar program: "))

    except ValueError:

       print "Masukkan nilai 0 untuk berhenti.."

 

OUTPUT

 

Berikut adalah contoh output yang dihasilkan apabila program ini di akses.

 

Pilih masukkan yang anda kehendaki seperti berikut

Masukkan 1 untuk Simbol unsur; 2 untuk Nama unsur; 3 untuk Nombor Atom unsur: 1

Masukkan Simbol unsur yang anda kehendaki: K

Nama Unsur =  Kalium

Nombor Atom =  19

Jisim Atom Relatif (g/mol)=  39.1

Ketumpatan (g/cm-3)=  0.86

Takat Lebur (darjah Celcius) =  63.7

Takat Didih(darjah Celcius) =  760

Tenaga Pengionan Pertama(kJ/mol) =  418

Enter 0 untuk keluar program:

Masukkan nilai 0 untuk berhenti..

Pilih masukkan yang anda kehendaki seperti berikut

Masukkan 1 untuk Simbol unsur; 2 untuk Nama unsur; 3 untuk Nombor Atom unsur: 2

Masukkan Nama unsur yang anda kehendaki: Klorin

Simbol Unsur =  Cl

Nombor Atom =  17

Jisim Atom Relatif(g/mol) =  35.45

Ketumpatan (g/cm-3)=  1.56

Takat Lebur(darjah Celcius) =  -101

Takat Didih (darjah Celcius)=  -34.7

Tenaga Pengionan Pertama(kJ/mol) =  1260

Enter 0 untuk keluar program:

Masukkan nilai 0 untuk berhenti..

Pilih masukkan yang anda kehendaki seperti berikut

Masukkan 1 untuk Simbol unsur; 2 untuk Nama unsur; 3 untuk Nombor Atom unsur: 3

Masukkan Nombor Atom yang anda kehendaki: 8

Nama Unsur =  Oksigen

Simbol Unsur =  O

Jisim Atom Relatif(g/mol) =  16.0

Ketumpatan (g/cm-3)=  1.14

Takat Lebur(darjah Celcius) =  -219

Takat Didih(darjah Celcius) =  -183

Tenaga Pengionan Pertama(kJ/mol) =  1310

Enter 0 untuk keluar program:

Masukkan nilai 0 untuk berhenti..

Pilih masukkan yang anda kehendaki seperti berikut

Masukkan 1 untuk Simbol unsur; 2 untuk Nama unsur; 3 untuk Nombor Atom unsur: 4

Maaf!Tiada Maklumat..

Enter 0 untuk keluar program:

Masukkan nilai 0 untuk berhenti..

Pilih masukkan yang anda kehendaki seperti berikut

Masukkan 1 untuk Simbol unsur; 2 untuk Nama unsur; 3 untuk Nombor Atom unsur: 3

Masukkan Nombor Atom yang anda kehendaki: 45

Tiada Maklumat

Enter 0 untuk keluar program: 0

 

 

 

 

Keterangan Tentang Program:

 

Program ini adalah untuk membaca 30 unsur pertama dalam jadual berkala. Pembinaan program ini menggunakan list sebagai database, gelung while, dan if,else,elif sebagai decision maker dan try&exceptvalueerror sebagai penamat program ini.

 

Pemilihan list sebagai database adalah kerana ianya mudah di ‘edit’ jika terdapat perubahan atau penambahan maklumat tentang unsur. Selain itu, list juga mudah dilihat secara keseluruhannya.

 

Gelung while digunakan sebagai pembinaan proses pengulangan. Program ini akan diulang selagi pengguna memilih untuk meneruskan pencarian. Gelung while juga mudah kerana pernyataannya adalah ringkas selagi syarat dipenuhi.

 

Untuk pemilihan unsur dalam database, if,else,elif digunakan. Pengguna diberi pilihan untuk memilih samada untuk mencari maklumat unsur berdasarkan simbol, nama atau nombor atom unsur. Ini bertujuan untuk membina program yang lebih mesra pengguna.

 

Bagi pengguna menamatkan akses program, pembinaan struktur try & exceptValueError digunakan.