Mean-Variance-Standard Deviation Calculator Error

My code so far

import numpy as np

def calculate(list):
   if len(list)!=9:
     raise ValueError("List must contain nine numbers.") 
   else:
       a=np.array(list).reshape((3, 3))
       b=[np.mean(a,axis=0).tolist(),np.mean(a,axis=1).tolist(),np.mean(a)]
       c=[np.var(a,axis=0).tolist(),np.var(a,axis=1).tolist(),np.var(a)]
       d=[np.std(a,axis=0).tolist(),np.std(a,axis=1).tolist(),np.std(a)]
       e=[np.max(a,axis=0).tolist(),np.max(a,axis=1).tolist(),np.max(a)] 
       f=[np.min(a,axis=0).tolist(),np.min(a,axis=1).tolist(),np.min(a)]  
       g=[np.sum(a,axis=0).tolist(),np.sum(a,axis=1).tolist(),np.sum(a)]    
       calculations = {
         "mean":[b],
       "variance":[c],
       "standard deviation":[d],
       "maximum":[e],
       "minimum":[f],
       "sum":[g]}


       return calculations

these are the error messages I get from my code:

======================================================================
ERROR: test_calculate (test_module.UnitTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/boilerplate-mean-variance-standard-deviation-calculator/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 "/usr/lib/python3.8/unittest/case.py", line 943, in assertAlmostEqual
    diff = abs(first - second)
TypeError: unsupported operand type(s) for -: 'dict' and 'dict'

======================================================================
ERROR: test_calculate2 (test_module.UnitTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/boilerplate-mean-variance-standard-deviation-calculator/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 "/usr/lib/python3.8/unittest/case.py", line 943, in assertAlmostEqual
    diff = abs(first - second)
TypeError: unsupported operand type(s) for -: 'dict' and 'dict'

----------------------------------------------------------------------
Ran 3 tests in 0.066s

FAILED (errors=2)
 




 

 

Challenge: Mean-Variance-Standard Deviation Calculator

Link to the challenge:

Take a closer look at the names of expected keys in the returned dictionary.

I have the same error as this guy, but what do you mean by the expected keys in the returned dictionary?

You’re going to want to start a new topic and include your code for us to be best able to help.