+ 1
need help solving 1st project in the data science course
Hi, I am trying to do the first project in the data science course, but my code does not pass the last two tests, and I have no idea why. Has anyone any idea or could give some help on how to find out what those tests could be testing? Thanks in advance for your help! Here is my code: import numpy as np n, p = [int(x) for x in input().split()] arr = np.array([]) for i in range(n): r = np.array([round(float(x),2) for x in input().split()]) if arr.any(): arr = np.vstack((arr, r)) else: arr = r print(np.mean(arr, axis=1))
4 Respostas
+ 2
import numpy as np
n, p = [int(x) for x in input().split()]
X= np.empty([n, p])
for i in range(n):
X[i,] = input().split()
print(np.around(X.mean(axis=1),2))
+ 1
What is the error message?
+ 1
There is no error message.
I just get three green ticks for the three first tests, and two red ticks for the last two tests, that's it. I dont know how to figure out what is missing in my code to pass those last two tests as they are hidden.
+ 1
Thanks! I hadnt thought of adding another rounding on the final printed array. Now it is working. Thank you!