0
This is my code about row means problem.check my code, please~~
n, p = [int(x) for x in input().split()] import numpy as np list1 = [] for _ in range(n): list1.append(list(map(float,input().split()))) np_list1 = np.array(list1) print(np.mean(np_list1 , axis=1))
2 Réponses
0
um h
I'm assuming this is the "Average of Rows" Code Project. Your code is correct so far, but needs one last adjustment. The task description says that the final mean values in the 1d array are to be rounded to 2 decimal places.
There are couple of ways to do this. I suggest you use the `np.around()` function on your final array before printing, something like this:
print(np.around(np_list.mean(axis=1), 2))
0
Thank you very much!!!!
You give me big help~^^