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))

12th Jan 2023, 2:00 AM
um h
um h - avatar
2 ответов
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))
12th Jan 2023, 3:28 AM
Mozzy
Mozzy - avatar
0
Thank you very much!!!! You give me big help~^^
12th Jan 2023, 4:10 AM
um h
um h - avatar