Mean-Variance-Standard Deviation Calculator Challenge

Buenas tardes, estoy completando el Challenge de [Mean-Variance-Standard Deviation Calculator Challenge]
probe varios cambios en el codigo pero todavia sigo teniendo este error.
Mi codigo:

if len(list) < (9):
  
    raise ValueError ('List must contain nine numbers.')
    
    data = np.array(list).reshape(3,3)
  
    meanaxis1 = np.mean(data, axis=0).tolist()
    meanaxis2 = np.mean(data, axis=1).tolist()
    meanflatten = np.mean(data.flatten()).tolist()

    varianceaxis1= np.var(data, axis=0).tolist()
    varianceaxis2= np.var(data, axis=1).tolist()
    varianceflatten= np.var(data.flatten()).tolist()

    stdaxis1= np.std(data,axis=0).tolist()
    stdaxis2= np.std(data,axis=1).tolist()
    stdflatten= np.std(data.flatten()).tolist()

    maxaxis1= np.max(data,axis=0).tolist()
    maxaxis2= np.max(data, axis=1).tolist()
    maxflatten= np.max(data.flatten()).tolist()

    minaxis1= np.min(data, axis=0).tolist()
    minaxis2= np.min(data, axis=1).tolist()
    minflatten= np.min(data.flatten()).tolist()

    sumaxis1= np.sum(data, axis =0).tolist()
    sumaxis2= np.sum(data, axis= 1).tolist()
    sumflatten= np.sum(data.flatten()).tolist()
    
    calculations = {
                    'mean' : [meanaxis1, meanaxis2, meanflatten],
                    'variance' : [varianceaxis1 , varianceaxis2, varianceflatten],
                    'standard deviation' : [stdaxis1, stdaxis2, stdflatten],
                    'max' : [maxaxis1, maxaxis2, maxflatten],
                    'min' : [minaxis1, minaxis2, maxflatten],
                    'sum' : [sumaxis1, sumaxis2, sumflatten],                     }
    
                    

    
    
    return calculations

Y el error

 python main.py
None
EE.
======================================================================
ERROR: test_calculate (test_module.UnitTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/boilerplate-mean-variance-standard-deviation-calculator-5/test_module.py", line 10, in test_calculate
    self.assertAlmostEqual(actual, expected, "Expected different output when calling 'calculate()' with '[2,6,2,8,4,0,1,5,7]'")
  File "/nix/store/06c55y0c5yzx5gx4l6k0pp6071zf1y5i-python3-3.8.13/lib/python3.8/unittest/case.py", line 943, in assertAlmostEqual
    diff = abs(first - second)
TypeError: unsupported operand type(s) for -: 'NoneType' and 'dict'

======================================================================
ERROR: test_calculate2 (test_module.UnitTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/boilerplate-mean-variance-standard-deviation-calculator-5/test_module.py", line 15, in test_calculate2
    self.assertAlmostEqual(actual, expected, "Expected different output when calling 'calculate()' with '[9,1,5,3,3,3,2,9,0]'")
  File "/nix/store/06c55y0c5yzx5gx4l6k0pp6071zf1y5i-python3-3.8.13/lib/python3.8/unittest/case.py", line 943, in assertAlmostEqual
    diff = abs(first - second)
TypeError: unsupported operand type(s) for -: 'NoneType' and 'dict'

----------------------------------------------------------------------
Ran 3 tests in 0.051s

FAILED (errors=2)

Entiendo por lo que he leido que no estaria devolviendo la variable calculations como una Lista, pero no encuentro el error, o donde definirlo

Can you please give the link to the replit? Without seeing all code it’s not possible to help

There it goes:
https://replit.com/@FedeHorus/boilerplate-mean-variance-standard-deviation-calculator-5#mean_var_std.py

you return None because everything is inside your if statement

Got it! There was also an error in key ‘min’ , as it should of be ‘minflatten’ not ‘maxflatten’ :sweat_smile:. thanks!