The python program failed the test.

def shape(M):
    a = 0
    b = len(M)
    for i in M:
        if a<len(i):
            a=len(i)
    return b,a

run-I-e test.py LinearRegressionTestCase.test_shape

 def test_shape(self):

        for _ in range(10):
            r,c = np.random.randint(low=1,high=25,size=2)
            matrix = np.random.randint(low=-10,high=10,size=(r,c))
            self.assertEqual(shape(matrix.tolist()),(r,c),"Wrong answer")
< H1 > E < / H1 > < H2 > ERROR: test_shape (_ _ main__.LinearRegressionTestCase) < / H2 >

Traceback (most recent call last):
File "C:UsersderekDesktopudacity examples including 3linear _ algebra-mastertest.py", line 14, in test_shape

self.assertEqual(shape(matrix.tolist()),(r,c),"Wrong answer")

NameError: global name "shape" is not defined

< hr >

Ran 1 test in 0.004s

FAILED (errors=1)

Mar.04,2021

do you have a code file for the import shape function in the test file? Obviously no function was found.

Menu