Conversation
tianyi21
left a comment
There was a problem hiding this comment.
Hi Ana Cristina,
✅ You implemented the function to read and display a file.
✅ You completed the patient_summary() function to summarize a file.
detect_problems() function to check the file.
detect_problems() function is expected to return a Boolean variable (True / False). However, in your current version and the test case, it is returning None instead. Could you please check your implementation and identify why this is not working as expected?
Please revise your current submission to address the
Thanks,
Tianyi [LS]
|
I have made changes, please review :) |
tianyi21
left a comment
There was a problem hiding this comment.
Thank you for revising your submissions.
In your current version, you replaced return with return bool(). Your thoughts is almost correct, but it just needs a small touch to make it work properly.
bool() is a Python built-in function that converts its input to a Boolean variable. Therefore, when we write bool() without any input, it always returns False. In your detect_problem() function, if you return bool(), False will always be returned regardless of the results of check_zeros(). To check this, you may try running your current version with the following code:
for f in all_paths:
print(detect_problems(f))
You should see three True's.
The provided helper function check_zeros() returns the result of len(flag) > 0. In Python, this statement is evaluated as either True or False based on the content of a file (whether it contains all-zero rows), i.e., the returned value of check_zeros() is a Boolean variable.
Based on my comment, can you think about what should be returned by the detect_problem() function?
|
When I saw the output "none", I thought my code was correct because I printed the 60 entries of the function and I did not see any zeros. Am I looking in the wrong place? I used the same function that was marked correctly for item number 2. Where are those zeroes? Also, if there are zeroes, i should see True as an outfut, not "none", so the detect_problem() function is definitely not working, but I can't figure out why. |
|
Ok, now I managed to see Trues and Falses using the function you gave me |
|
I understand now!! I didn't realize I was looking into one file only throughout the assignment. I thought my array had average values from all files and we were looking into all of them. Now I understand we are looking into several files, but the tests were focused on the first one (all_paths[0]). I think it works now! And I also think the files that show "False" are files with problems, because if the mean of the measurments is zero, then they are probably empty/error files? |
tianyi21
left a comment
There was a problem hiding this comment.
The updated version looks good! One minor comment is since you're returning check_zeros(), there is no need to run the function twice.
You may either use a variable to save the result and return the variable:
checked = check_zeros(data_mean)
return checked
Or directly return the function (return the return):
# check_zeros(data_mean) # <- we don't need this
return check_zeros(data_mean)
🎉 Your A2 is complete!
🎊 All your Python assessments are now complete. Thank you for your participation, and I wish you all the best for your future!
Tianyi [LS]
|
thank you! :) |
What changes are you trying to make? (e.g. Adding or removing code, refactoring existing code, adding reports)
I completed my second assignment and created the assignment 2 branch
What did you learn from the changes you have made?
I need to do it a few more times before I learn how to create branches and push changes
Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?
I tried creating the branch on git first, but it would never show in visual studio.. so i created it on visual studio instead and did the pushing and committing using visual studio
Were there any challenges? If so, what issue(s) did you face? How did you overcome it?
I wasn't 100% sure of what i was doing, so i hope it worked. I added a few tests of my own because I thought it was helping
How were these changes tested?
Creating a few additional code chunks..
A reference to a related issue in your repository (if applicable)
Checklist