# Mean-Variance-Standard Deviation Calculator Bug

Hello, I tried to define the calculator code and I am not getting my desired results.

CODE:

``````import numpy as np

def calculate(list):
if len(list)!=9:
raise ValueError("List must contain nine numbers.")
else:
a=np.reshape(list,(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

``````

Can I get help with debugging this please and thank you

User Agent is: `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.101 Safari/537.36`.

Challenge: Mean-Variance-Standard Deviation Calculator

Welcome to FCC!

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (`</>`) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

You need to compare your output to the specified output. First, all your calculations are returned as arrays of tuples of arrays when they should be arrays of arrays. Second, you have misnamed `maximum` and `minimum`.

There may be other issues as well, but use the tests and check your output against the expected output to find any others.

For a start: a, b, c… are really bad names for variables.
Then maybe print out the objects you are creating, to see what you are actually doing.
For example, b is supposed to be a list. You create a tuple and place that into a list. Which is still a tuple inside a list.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.