**Tell us what’s happening:**

I solved the challenge quite fast but even though when I ask the result lists of their class and they show me that they are Python lists, the print shows the ‘array’ in front of the list as if it is a numpy.array

Like this naturally it always fails the test_module.

**Your code so far**

import numpy as np

def calculate(list):

print(list)

x =

```
try:
x = np.array(list).reshape(3, 3)
except ValueError :
raise ValueError("List must contain nine numbers.")
print(x)
calculations = dict([
('mean', [x.mean(0), x.mean(1), x.mean()].__class__),
('variance', [x.var(0), x.var(1), x.var()]),
('standard deviation', [x.std(0), x.std(1), x.std()]),
('max', [x.max(0), x.max(1), x.max()]),
('min', [x.min(0), x.min(1), x.min()]),
('sum', [x.sum(0), x.sum(1), x.sum()])
])
print(calculations)
return calculations
```

calculate([9,1,5,3,3,3,2,9,0])

# ** resulting output **

python test_module.py

[9, 1, 5, 3, 3, 3, 2, 9, 0]

[[9 1 5]

[3 3 3]

[2 9 0]]

{‘mean’: <class ‘list’>, ‘variance’: [array([ 9.55555556, 11.55555556, 4.22222222]), array([10.66666667, 0. , 14.88888889]), 9.209876543209875], ‘standard deviation’: [array([3.09120617, 3.39934634, 2.05480467]), array([3.26598632, 0. , 3.8586123 ]), 3.0347778408328137], ‘max’: [array([9, 9, 5]), array([9, 3, 9]), 9], ‘min’: [array([2, 1, 0]), array([1, 3, 0]), 0], ‘sum’: [array([14, 13, 8]), array([15, 9, 11]), 35]}

[2, 6, 2, 8, 4, 0, 1, 5, 7]

[[2 6 2]

[8 4 0]

[1 5 7]]

{‘mean’: <class ‘list’>, ‘variance’: [array([9.55555556, 0.66666667, 8.66666667]), array([ 3.55555556, 10.66666667, 6.22222222]), 6.987654320987654], ‘standard deviation’: [array([3.09120617, 0.81649658, 2.94392029]), array([1.88561808, 3.26598632, 2.49443826]), 2.6434171674156266], ‘max’: [array([8, 6, 7]), array([6, 8, 7]), 8], ‘min’: [array([1, 4, 0]), array([2, 0, 1]), 0], ‘sum’: [array([11, 15, 9]), array([10, 12, 13]), 35]}

E[9, 1, 5, 3, 3, 3, 2, 9, 0]

[[9 1 5]

[3 3 3]

[2 9 0]]

{‘mean’: <class ‘list’>, ‘variance’: [array([ 9.55555556, 11.55555556, 4.22222222]), array([10.66666667, 0. , 14.88888889]), 9.209876543209875], ‘standard deviation’: [array([3.09120617, 3.39934634, 2.05480467]), array([3.26598632, 0. , 3.8586123 ]), 3.0347778408328137], ‘max’: [array([9, 9, 5]), array([9, 3, 9]), 9], ‘min’: [array([2, 1, 0]), array([1, 3, 0]), 0], ‘sum’: [array([14, 13, 8]), array([15, 9, 11]), 35]}

E[2, 6, 2, 8, 4, 0, 1]

.

## ERROR: test_calculate (**main**.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 “/nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10/unittest/case.py”, line 876, in assertAlmostEqual

diff = abs(first - second)

TypeError: unsupported operand type(s) for -: ‘dict’ and ‘dict’

## ======================================================================

ERROR: test_calculate2 (**main**.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 “/nix/store/xf54733x4chbawkh1qvy9i1i4mlscy1c-python3-3.10.11/lib/python3.10/unittest/case.py”, line 876, in assertAlmostEqual

diff = abs(first - second)

TypeError: unsupported operand type(s) for -: ‘dict’ and ‘dict’

Ran 3 tests in 0.019s

FAILED (errors=2)

exit status 1

**Challenge:** Data Analysis with Python Projects - Mean-Variance-Standard Deviation Calculator

**Link to the challenge:**

I am trying to learn Python which is why I am doing this and I try to understand why:

[x.mean(0), x.mean(1), x.mean()].**class** ==> results in <class ‘list’>

but prints something like:

‘variance’: [array([ 9.55555556, 11.55555556, 4.22222222]), array([10.66666667, 0. , 14.88888889]), 9.209876543209875] ==> means it is a numpy.array ?!?

If I try to convert it like :

[x.mean(0), x.mean(1), x.mean()].tolist() ==> it gives me an error as this method is not implemented for lists.

I would appreciate very much if someone could help me with my confusion.

Thanks,

Stephan