コード例 #1
0
def test_10_10_1():
    expected = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10], \
                [2, 4, 6, 8, 10, 12, 14, 16, 18, 20], \
                [3, 6, 9, 12, 15, 18, 21, 24, 27, 30], \
                [4, 8, 12, 16, 20, 24, 28, 32, 36, 40], \
                [5, 10, 15, 20, 25, 30, 35, 40, 45, 50], \
                [6, 12, 18, 24, 30, 36, 42, 48, 54, 60], \
                [7, 14, 21, 28, 35, 42, 49, 56, 63, 70], \
                [8, 16, 24, 32, 40, 48, 56, 64, 72, 80], \
                [9, 18, 27, 36, 45, 54, 63, 72, 81, 90], \
                [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]]
    assert multiplication_table(10, 10, 1) == expected
コード例 #2
0
def test_10_10__3():
    expected = [[-3, -6, -9, -12, -15, -18, -21, -24, -27, -30], \
                [-6, -12, -18, -24, -30, -36, -42, -48, -54, -60], \
                [-9, -18, -27, -36, -45, -54, -63, -72, -81, -90], \
                [-12, -24, -36, -48, -60, -72, -84, -96, -108, -120], \
                [-15, -30, -45, -60, -75, -90, -105, -120, -135, -150], \
                [-18, -36, -54, -72, -90, -108, -126, -144, -162, -180], \
                [-21, -42, -63, -84, -105, -126, -147, -168, -189, -210], \
                [-24, -48, -72, -96, -120, -144, -168, -192, -216, -240], \
                [-27, -54, -81, -108, -135, -162, -189, -216, -243, -270], \
                [-30, -60, -90, -120, -150, -180, -210, -240, -270, -300]]
    assert multiplication_table(10, 10, -3) == expected
コード例 #3
0
def test_5_3_2():
    expected = [[2, 4, 6, 8, 10], [4, 8, 12, 16, 20], [6, 12, 18, 24, 30]]
    assert multiplication_table(5, 3, 2) == expected
コード例 #4
0
def test_5_3__2():
    expected = [[-2, -4, -6, -8, -10], [-4, -8, -12, -16, -20],
                [-6, -12, -18, -24, -30]]
    assert multiplication_table(5, 3, -2) == expected
コード例 #5
0
def test_1_1__1():
    assert multiplication_table(1, 1, -1) == [[-1]]
コード例 #6
0
def test_1_1_0():
    assert multiplication_table(1, 1, 0) == [[0]]
コード例 #7
0
def test_1_1_4():
    assert multiplication_table(1, 1, 4) == [[4]]
コード例 #8
0
def test_0_0_4():
    assert multiplication_table(0, 0, 4) == None
コード例 #9
0
def test_5_3_1():
    expected = [[1, 2, 3, 4, 5], [2, 4, 6, 8, 10], [3, 6, 9, 12, 15]]
    assert multiplication_table(5, 3, 1) == expected
コード例 #10
0
def test_25_3_10():
    expected = [[10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250], \
                [20, 40, 60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320, 340, 360, 380, 400, 420, 440, 460, 480, 500], \
                [30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330, 360, 390, 420, 450, 480, 510, 540, 570, 600, 630, 660, 690, 720, 750]]
    assert multiplication_table(25, 3, 10) == expected