Data Analysis with Python Projects - Mean-Variance-Standard Deviation Calculator Help

Tell us what’s happening:
I’m trying to understand and practice numpy.
While doing a particular project,
even though the output matches what’s required,
it keeps throwing errors.
Could someone please guide me?

Your code so far
import numpy as np
def calculate(list):

if len(list)!=9:
    print("List should have 9 elements")


'mean':[(np.mean(ls,axis=1)).tolist(), (np.mean(ls,axis=0)).tolist(), np.mean(ls)],

'variance':[(np.var(ls,axis=1)).tolist(), (np.var(ls,axis=0)).tolist(), np.var(ls)],

'standard deviation':[(np.std(ls,axis=1)).tolist(), (np.std(ls,axis=0)).tolist(), np.std(ls)],

'max':[(np.max(ls,axis=1)).tolist(), (np.max(ls,axis=0)).tolist(), np.max(ls)],

'min':[(np.min(ls,axis=1)).tolist(), (np.min(ls,axis=0)).tolist(), np.min(ls)],

'sum':[(np.sum(ls,axis=1)).tolist(), (np.sum(ls,axis=0)).tolist(), np.sum(ls)]}


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36.

Challenge: Mean-Variance-Standard Deviation Calculator

Link to the challenge:

Welcome to the forums.

First, please post a link to the live project (, for instance) as it makes running your code and looking at the test output easier. You are correct; your values do appear to be correct.

is the first problem. When I run this code locally I get:

AttributeError: 'list' object has no attribute 'reshape'

reshape() is a method of an np.array() I believe. Secondly,

while correct, does not comply with the program specs that call for raising a ValueError if the list does not contain nine elements.

Finally, when I fixed those two problems, your code displayed your results in a different order than mine so you’ll need to take a look at the order for the two calculation tests.

Good luck.