Here is two lists: list = [[1, 2], [3, 4]] and list = [1, 2, 2, 3, 4]

I would like to calculate the mean of the lists. This is my code thus far and outputs:

```
 def summary(x):
      mean1 = np.mean(x)

      Dict = {"mean":mean1}
 return Dict

summary([1, 2, 2, 3, 4])
My output is == {'mean': 2.4}

summary([[1, 2], [3, 4]])
My output is == error

```

I would just like to know what should i change to my code so that 2D arrays also work if i give it as input and not only just 1D arrays?

I have seen that i should insert (x, axis=1) but then it only works for 2Darray and not again for the 1D array.

I would like the 2D mean to give me output: 'mean': [1.5, 3.5]