Posts

Showing posts with the label Functional Programming

Create Classes at Python

Image
Dear All, Today, I discuss about Class in Python. in Object Oriented Programming (OOP) we must have known some OOP Concepts such as Inheritance, Polymorhism, Overloading, and of course basic concept using Class and Object. At this ocassion, I would to share to make simple Class in Python for Aritmethics such as how to count largenes from the rectangle. Oke, let's practice, please open your Python IDLE and type code bellow : >>>class Segiempat:       def __init__(self, p, l):          self.panjang = p          self.lebar = l      def luas(self):          return self.panjang * self.lebar      def keliling(self):          return 2 * (self.panjang + self.lebar)  Oke, on the  source code above ; we create class named Se giempat and we also create some functions ( init, fucntion of luas and ...

List and Scoring Case Study - Online Class

Image
Dear All. pada sesi ini, silahkan anda cobakan kode berikut ini (langsung coding di Laptop anda masing-masing) tuliskan kode berikut di text editor (e.g. Notepad, Notepad++, etc). selanjutnya jalankan di Command Front untuk menjalankan Program Python tersebut : data_a = [     ['101','Irsyad',85,79],     ['102','Rahmat',90,82],     ['103','Beni',75,60],     ['104','Beno',60,50],     ['105','Chandra',40,45],     ['106','Deni',65,50],     ['107','Diki',70,75],     ['108','Ega',35,40],     ['109','Farah',90,85] ] def cetaknilai(data):     # mendefinisikan fungsi lokal     def hitungnilai(uts,uas):         return(0.4 * uts) + (0.6 * uas)     # mendefinisikan fungsi lokal     def ambilindeks(nilai):          ...