ERROR in code please help

Tell us what’s happening:
Describe your issue in detail here.
kindly help and tell what im doing wrong

Your code so far

import numpy as np

def calculate(list):
        if len(list) ! = 9 :
            raise ValueError("list must contains nine number")

        list = np.array(list).reshape((3, 3))

    mean = [list.mean(axis=0).tolist(),list.mean(axis=1).tolist(), np.mean(list).tolist()]
    variance = [list.variance(axis=0).tolist(),list.variance(axis=1).tolist(), np.variance(list).tolist()]
    std_dev = [list.std(axis=0).tolist(),list.std(axis=1).tolist(), np.std(list).tolist()]
    max = [list.max(axis=0).tolist(),list.max(axis=1).tolist(), np.max(list).tolist()]
    min = [list.min(axis=0).tolist(),list.min(axis=1).tolist(), np.min(list).tolist()]
    sum = [list.sum(axis=0).tolist(),list.sum(axis=1).tolist(), np.sum(list).tolist()]
        "mean" : mean,
        "variance" : variance,
        "standard deviation" : std_dev,
        "max" : max,
        "min" : min,
        "sum" : sum,

Your browser information:

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

Challenge: Mean-Variance-Standard Deviation Calculator

Link to the challenge:

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 (’).

1 Like

What error are you getting? What did you try already to fix it?

1 Like

this what im getting as error message

Python uses indentation to distinguish code that should go together. Notice that lines with if condition and list defining have different indentation than lines below, which are also part of the calculate function.

1 Like

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