Error with execise

Tell us what’s happening:
Describe your issue in detail here.
When i execute exercise about Numpy in Python then i alway recieve error “test_calculate_with_few_digits
self.assertRaisesRegex(ValueError, “List must contain nine numbers.”, mean_var_std.calculate, [2,6,2,8,4,0,1,])
AssertionError: ValueError not raised by calculate”

I don’t know what i wrong

Your code so far

def calculate(list):
if len(list) == 9:
# arr=np.array(list)
v_mean=([np.mean(arr,axis=0).tolist(), np.mean(arr,axis=1).tolist(),np.mean(arr).tolist()])
v_variance=([np.var(arr,axis=0).tolist(), np.var(arr,axis=1).tolist(), np.var(arr).tolist()])
#Standard Deviation
v_standard = ([np.std(arr,axis=0).tolist(), np.std(arr, axis=1).tolist(), np.std(arr).tolist()])
v_max = ([np.max(arr,axis=0).tolist(), np.max(arr, axis=1).tolist(), np.max(arr).tolist()])
v_min = ([np.min(arr,axis=0).tolist(), np.min(arr, axis=1).tolist(), np.min(arr).tolist()])
v_sum = ([np.sum(arr,axis=0).tolist(), np.sum(arr, axis=1).tolist(), np.sum(arr).tolist()])
v_dict ={
‘mean’: v_mean,
‘standard deviation’:v_standard,
return v_dict
ValueError (“List must contain nine numbers.”)
return 0

Your browser information:

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

Challenge: Mean-Variance-Standard Deviation Calculator

Link to the challenge:

Exceptions in python are raised with raise keyword.

thanks Sanity. The problem solved.

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