コード例 #1
0
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"
コード例 #2
0
ファイル: test.py プロジェクト: ilesanmi-code/python_Class
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)
コード例 #3
0
 def square(self, a):
     self.result = square(a)
     return self.result
コード例 #4
0
ファイル: Astar.py プロジェクト: adamssonj/projects
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)