- 1

what is the solution n, p = [int(x) for x in input().split()]

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]

11th Nov 2021, 8:38 AM
Zaid Zren
Zaid Zren - avatar
4 odpowiedzi
+ 2
n, p = [int(x) for x in input().split()] import numpy as np arr=np.ones((n,p)) for i in range(n): arr[i,:]=np.array(input().split()) mean =arr.mean(axis=1).round(2) print(mean)
30th May 2022, 8:55 PM
At_har
0
#Try this in Python : lens = list(map(lambda x : int(x), input().split(" "))) avg = [] for i in range(lens[0]) : avg.append(round(sum(list(map(lambda x : float(x), input().split(" ")))) / lens[1], 2)) print(avg)
12th Nov 2021, 11:57 PM
VCoder
VCoder - avatar
0
n, p = [int(x) for x in input().split()] import numpy as np lijst = [[0]*p for _ in range(n)] #print (n) #print (p) #print (lijst) for i in range(n): lijst[i] = [float(j) for j in input().strip().split(" ")] #print(lijst) npArray = np.array(lijst) #print(npArray) #npArray = npArray.astype(np.float64) gemiddeldRij = npArray.mean(axis=1).round(2) print(gemiddeldRij)
18th May 2022, 5:18 PM
Laurent
- 1
n, p = [int(x) for x in input().split()] import numpy as np list1 = [] for i in range(n): list1.append(input().split()) #print(list1) L1_array = np.array(list1) #print(list1_array) L1_array = L1_array.astype(np.float) mean = L1_array.mean(axis=1).round(2) print(mean)
3rd Feb 2022, 11:59 AM
Shadab Alam
Shadab Alam - avatar