+ 1

How can I debug a failed hidden test for code project?

I am trying to complete the Data Science 8 Code project: Average of Rows. It completes all tests except the last one which is hidden. How can i find out why it's failing the final test? I thought it may be because the last test output was int instead of float, but I added an if statement that should of resolved that and it still fails the last test. https://code.sololearn.com/cdJ85oIgBOu0/?ref=app

16th Dec 2021, 8:39 PM
NotSoSocial
NotSoSocial - avatar
4 Respostas
+ 3
Review the operations section of the course that preceeded this module project. Pay attention to the yellow boxes and some of the available methods of a numpy array. Reread the task as it gives you a hint as to what method needs to be used in the description. Build the passed in matrix as a list then convert that list to a numpy array. Loop over each row and find its "average", using the aforementioned method, rounding to 2 decimal places, and add each rows average to a list. Then convert this list to a numpy array and output it.
16th Dec 2021, 10:03 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
using the mean method solved the issue. I guess the method has some difference in precision that effected the round function slightly.
16th Dec 2021, 10:51 PM
NotSoSocial
NotSoSocial - avatar
0
Pls provide project description
16th Dec 2021, 9:27 PM
Emerson Prado
Emerson Prado - avatar
0
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]
16th Dec 2021, 9:33 PM
NotSoSocial
NotSoSocial - avatar