0

help me to solve this....

In a matrix, or 2-d array X, the averages (or means) of the elements of rows is called row means. Task Given a 2D array, return the rowmeans. Input Format First line: two integers separated by spaces, the first indicates the rows of matrix X (n) and the second indicates the columns of X (p) Next n lines: values of the row in X Output Format An numpy 1d array of values rounded to the second decimal. 2 2 1.5 1 2 2.9 Sample Output [1.25 2.45]

3rd Aug 2021, 8:06 AM
Idris Rèmilèkoun AMINOU
Idris Rèmilèkoun AMINOU - avatar
6 Answers
+ 2
you can change the last line to: print(np.array(list).round(2))
3rd Aug 2021, 4:16 PM
Julia Shabanova
Julia Shabanova - avatar
+ 2
the result should be rounded to the second decimal
3rd Aug 2021, 2:18 PM
Julia Shabanova
Julia Shabanova - avatar
+ 1
Julia Shabanova it works thank u so much 👌✌️👍🙏
3rd Aug 2021, 5:48 PM
Idris Rèmilèkoun AMINOU
Idris Rèmilèkoun AMINOU - avatar
0
Post your code here
3rd Aug 2021, 8:35 AM
Atul [Inactive]
0
'''this is my code but the Last unknown test don't work and i don't know why ''' { import numpy as np n, p = [int(x) for x in input().split()] list=[] zero=np.zeros(shape=(n,p)) for i in range(n): zero [i,:] = np.array([float(x) for x in input().split()]) list.append(zero[i,:].mean()) print(np.array(list)) }
3rd Aug 2021, 9:49 AM
Idris Rèmilèkoun AMINOU
Idris Rèmilèkoun AMINOU - avatar
0
how to do this ? 😒
3rd Aug 2021, 3:53 PM
Idris Rèmilèkoun AMINOU
Idris Rèmilèkoun AMINOU - avatar