#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Mar 11 06:07:42 2019 @author: awangga """ import kalkulator a = 100 b = 50 hasil1 = kalkulator.Penambahan(a, b) hasil2 = kalkulator.Pengurangan(a, b) hasil3 = kalkulator.Perkalian(a, b) hasil4 = kalkulator.Pembagian(a, b)
coba = self.a + self.b #Coba merupakan atribut print(str(coba)) #File main.py import Kalkulator kal = Kalkulator.Kalkulator(1, 2) #Berikut merupakan objek kal.penambahan() ##No 4## import Kalkulator kal = Kalkulator ##No 5## from Kalkulator import Penambahan coba = Penambahan(1, 2) ##No 6## import Kalkulator hasil1 = Kalkulator.Penambahan(1, 2) print(str(hasil1)) ##No 7## import Kalkulator kal = Kalkulator.kalkulator(1, 2) hasil1 = kal.Penambahan() print(str(hasil1))