def test_square(): assert square(2) == 4, "Passed" assert square(2.0) == 4.0, "Passed" assert square(5) == 25, "Passed" assert square(5.0) == 25.0, "Passed" assert square(0) == 0, "Passed" assert square(-1) == 1, "Passed"
def main(): rect = Rectangle() sq = square(6) tri = Triangle() rect.breadth = 5 rect.length = 30 sq.length = 6 tri = Triangle() result1 = rect.area() result2 = tri.area() result3 = sq.area() #always observe the object used final = result3 + result2 + result1 print("behold... the reuslt", final)
def square(self, a): self.result = square(a) return self.result
def initSquares(): #Fill my array window.fill(black) for x in range(cols): for y in range(rows): grid[x][y] = square(window,x,y,squareWidth,squareHeight)