+ 1

# Can anyone tell me why my solution is wrong even though it works for me?

I wan to solve the Module 1 Quiz 'Average of Rows' of the Data Science course. https://www.sololearn.com/learning/eom-project/1093/111 I end my code and test it apart in the code playground, but when I run my code it just meet 3 of the test cases and I do not know why. This is my code: import numpy as np n, p = [int(x) for x in input().split()] list = [] for i in range(n): row = [float(j) for j in input().split()] list.append(row) arr = np.array(list) arr = arr.reshape((n,p)) print(arr.mean(axis = 1)) Please anyone tell me why it do not meet the whole of the cases...

8th Apr 2021, 1:38 AM
Bry4n
+ 2
U need get mean every row, when u generate list variable, for this u can get row.mean() or row.sum()/p. U don't need reshape. And don't forget about round on 2 char
8th Apr 2021, 2:49 AM
Илья Мирошник
+ 1
And finally if u have after questions, u can look on my solution https://code.sololearn.com/cHNUXN6kl3iF/?ref=app
8th Apr 2021, 2:57 AM
Илья Мирошник
+ 1
Thanks Илья Мирошник, I try rounding the mean to two floats and it works, so thank you again :D
8th Apr 2021, 3:01 AM
Bry4n
+ 1
Okay thanks a lot ;D
8th Apr 2021, 3:10 AM
Bry4n