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

Tell us what’s happening:
Describe your issue in detail here.
I’m getting this error TypeError: unsupported operand type(s) for -: ‘type’ and ‘dict’

I have ran my code in my local IDE and it works fine and also throws ValueError if the given list contains less that 9 elements.

import numpy as np

def calculate(list):
if len(list)==9:
arr=np.array(list).reshape(3,3)
mean=[[arr[:,:1].mean(),arr[:,1:2].mean(),arr[:,2:].mean()],[arr[:1,:].mean(),arr[1:2,:].mean(),arr[2:,:].mean()],arr.mean()]
var=[[arr[:,:1].var(),arr[:,1:2].var(),arr[:,2:].var()],[arr[:1,:].var(),arr[1:2,:].var(),arr[2:,:].var()],arr.var()]
std=[[arr[:,:1].std(),arr[:,1:2].std(),arr[:,2:].std()],[arr[:1,:].std(),arr[1:2,:].std(),arr[2:,:].std()],arr.std()]
max=[[arr[:,:1].max(),arr[:,1:2].max(),arr[:,2:].max()],[arr[:1,:].max(),arr[1:2,:].max(),arr[2:,:].max()],arr.max()]
min=[[arr[:,:1].min(),arr[:,1:2].min(),arr[:,2:].min()],[arr[:1,:].min(),arr[1:2,:].min(),arr[2:,:].min()],arr.min()]
sum=[[arr[:,:1].sum(),arr[:,1:2].sum(),arr[:,2:].sum()],[arr[:1,:].sum(),arr[1:2,:].sum(),arr[2:,:].sum()],arr.sum()]

``````  Calculations=dict([('Mean',mean),('Variance',var),("Standard Deviation",std),('Max',max),('Min',min),('Sum',sum)])

return type(sum)

else:
raise ValueError('List must contain nine numbers.')
``````

Chrome Browser

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

That error might be a bit misleading, but in here it means that result returned by function is not the same as expected result.

The result coming from my code matches with the one one present in the test_conditions template.

You can try running the above code and check

From what I can see, the capitalization of dictionary keys are different in what function returns.

hey, I am about to start this course but I noticed that the notebooks.ai which is used in this course is shutted down 2 years ago and we should use google colab instead. so is this course still usefull as it say how to work with notebooks.ai?

When you click on the starter link in the project description, the GitHub repo with the boilerplate code imports into a replit where you can complete the project code.

notebooks.ai isn’t necessary for Jupyter notebooks, I believe it was just an option for storing and editing Jupyter Notebook files and the preferred one of the person who presents the lessons, but there are plenty of other options like just running Jupyter through the command prompt or using the Google Research collab option.