4 Answers
New AnswerI 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...
4/8/2021 1:38:28 AM
Bry4n4 Answers
New AnswerU 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
And finally if u have after questions, u can look on my solution https://code.sololearn.com/cHNUXN6kl3iF/?ref=app
Thanks Илья Мирошник, I try rounding the mean to two floats and it works, so thank you again :D
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message