+ 2
How to simulate hidden test cases ?
In a question related to data science the 5th hidden test case is failing?How can we access this? DATA SCIENCE : 8 Average of Rows https://code.sololearn.com/cPj3C3q7thFh/?ref=app
8 Réponses
+ 9
By Read caption carefully 😂😂😂
+ 2
You can access the hidden test cases. Read the instruction carefully and correct your code
+ 2
G'day Sanjay Kamath as Lisa said (with a typo?) "You can't access the test cases".
But you can debug your code for logic flaws, most common are:
array not big enough, or
failing to check for zero values.
EDIT 2: task instructions
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]
+ 2
The output needs to match exactly the sample in the task description. Use numpy as suggested in the data science course, not array
+ 2
Lisa okay will try...
+ 1
HungryTradie Can you please help me out....Still no success.
+ 1
G'day Sanjay Kamath your code must be really close to correct, only test case 5 isn't passing!
I don't know enough about python to help you beyond: copy your code into a "code bit" and do some debugging with inputs that you know the results for. I would try lines with a zero, lines with a negative, etc etc.
I don't think you need to worry about your array size. Your output format is ok for the other 4 test cases, but perhaps test case 5 has a single row of values?? When do you add the space between output floats?
Sorry that I can't help more, good luck!
EDIT: I reckon it is your output formatting. Try testing with
5 2
1.5 1
2 2.9
2 2
1.5 1
2 2.9
0
HungryTradie Tried everything but failed...