# Data Analysis: Mean-Variance-Standard Deviation Calculator

I imported the project to replit. When I run my code, it shows - TypeError: unsupported operand type(s) for -: ‘dict’ and ‘dict’ and FAILED (errors=2)

Been searching it on google but i’m kinda lost right now. Here is replit link: boilerplate-mean-variance-standard-deviation-calculator - Replit

In this case it means that result returned by function is different from what test is expecting.

Method used in test is not able to determine what exactly is the difference between two dictionaries, as `dict` doesn’t support subtraction operation. However that method is still able to confirm when two dictionaries are the same (they have the same keys and values).

1 Like

I believe it is because tests want exact results. For example, if I get:

``````5.6667
``````

but test wants:

``````5.6666667
``````

then it fails the test (that was my experience, at least).

You are going to kick yourself, but:

``````{'mean': [[3.6666666666666665, 5.0, 3.0], [3.3333333333333335, 4.0, 4.333333333333333], 3.888888888888889], 'var': [[9.555555555555557, 0.6666666666666666, 8.666666666666666], [3.555555555555556, 10.666666666666666, 6.222222222222221], 6.987654320987654], 'std': [[3.091206165165235, 0.816496580927726, 2.943920288775949], [1.8856180831641267, 3.265986323710904, 2.494438257849294], 2.6434171674156266], 'max': [[8, 6, 7], [6, 8, 7], 8], 'min': [[1, 4, 0], [2, 0, 1], 0], 'sum': [[11, 15, 9], [10, 12, 13], 35]}
``````

The output that the test expects (which you can refer to in test_module.py):

``````{'mean': [[3.6666666666666665, 5.0, 3.0], [3.3333333333333335, 4.0, 4.333333333333333], 3.888888888888889], 'variance': [[9.555555555555557, 0.6666666666666666, 8.666666666666666], [3.555555555555556, 10.666666666666666, 6.222222222222221], 6.987654320987654], 'standard deviation': [[3.091206165165235, 0.816496580927726, 2.943920288775949], [1.8856180831641267, 3.265986323710904, 2.494438257849294], 2.6434171674156266], 'max': [[8, 6, 7], [6, 8, 7], 8], 'min': [[1, 4, 0], [2, 0, 1], 0], 'sum': [[11, 15, 9], [10, 12, 13], 35]}
``````

Spot the difference. (All of your numbers are correct)

Yeah, i got it correct. Thanks for checking.

But is it wrong because I used dict? I’m so lost with this.