Mean-var-std calculator TypeError: unsupported operand type(s) for -: 'dict' and 'dict'

Hi everyone,
It seems to me that I’m missing some small detail. I’ve compared my code output in VScode with the tests results and they are the same. Despite this, I’m getting the following type error:

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

So, could someone tell me what this problem means and how to solve it?

import numpy as np


def calculate(list):
    if len(list) != 9:
      raise ValueError ("List must contain nine numbers.")
    arr = np.array(list)
    arr_2d = arr.reshape(3, 3)
    calculations = {"mean": [np.mean(arr_2d, 0).tolist(), np.mean(arr_2d, 1).tolist(), np.mean(arr_2d)]}
    calculations["variance"] = [np.var(arr_2d, 0).tolist(), np.var(arr_2d, 1).tolist(), np.var(arr_2d)]
    calculations["standart deviation"] = [np.std(arr_2d, 0).tolist(), np.std(arr_2d, 1).tolist(), np.std(arr_2d)]
    calculations["max"] = [np.amax(arr_2d, 0).tolist(), np.amax(arr_2d, 1).tolist(), np.amax(arr_2d)]
    calculations["min"] = [np.amin(arr_2d, 0).tolist(), np.amin(arr_2d, 1).tolist(), np.amin(arr_2d)]
    calculations["sum"] = [np.sum(arr_2d, 0).tolist(), np.sum(arr_2d, 1).tolist(), np.sum(arr_2d)]
    return calculations

Here is
link to my code

Thanks for your attention!

Hello @SanAntonik.
I haven’t played with your code to see what is wrong but could it be the spelling of standard deviation? Yours is standart deviation while the test suite is using standard deviation

2 Likes

OMG, it worked. Thank you so much! So much time is wasted because I didn’t see that spelling mistake

2 Likes