import math class Lesson2: ''' A basic class that has the capabilities to add, subtract, multiply, divide, modulo and sqare root two inputs. ''' def __init__(self, x, y): self.x = x self.y = y def add(self): return self.x+self.y def sub(self): return self.x-self.y def mult(self): return self.x*self.y def div(self): return self.x/self.y def mod(self): return self.x%self.y def sqrt(self): return math.sqrt(self.x) if __name__ == "__main__": #A simple test with basic integers test = Lesson2(4,7) print test.add() print test.sub() print test.mult() print test.div() print test.mod() print test.sqrt() print '-'*20 #A simple test with a float and an integer print type(4.0) print test.add() print test.sub() print test.mult() print test.div() print test.mod() print test.sqrt() print '-'*20 #What happens if we try it with strings? test = Lesson2('cat','dog') print test.add() print test.sub() print test.mult() print test.div() print test.mod() print test.sqrt()