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.

Your code so far
import numpy as np

def calculate(list):
if len(list)==9:

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

  return type(sum)

  raise ValueError('List must contain nine numbers.')

Your browser information:
Chrome Browser

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

Link to the challenge:

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 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 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.

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