Skip to content

Assignment 2#2

Open
anacrdeoliveira wants to merge 6 commits intomainfrom
assignment-2
Open

Assignment 2#2
anacrdeoliveira wants to merge 6 commits intomainfrom
assignment-2

Conversation

@anacrdeoliveira
Copy link
Copy Markdown
Owner

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

  • [x ] I can confirm that my changes are working as intended

Copy link
Copy Markdown

@tianyi21 tianyi21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Ana Cristina,

✅ You implemented the function to read and display a file.
✅ You completed the patient_summary() function to summarize a file.
⚠️ You implemented the detect_problems() function to check the file.

⚠️ The 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 ⚠️ issue(s).

Thanks,
Tianyi [LS]

@anacrdeoliveira
Copy link
Copy Markdown
Owner Author

I have made changes, please review :)

Copy link
Copy Markdown

@tianyi21 tianyi21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@anacrdeoliveira
Copy link
Copy Markdown
Owner Author

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.

@anacrdeoliveira
Copy link
Copy Markdown
Owner Author

Ok, now I managed to see Trues and Falses using the function you gave me
for f in all_paths:
print(detect_problems(f))
However, I thought I was measuring the means only, which are all supposed to be different than zero, is that correct? I will update the code here

@anacrdeoliveira
Copy link
Copy Markdown
Owner Author

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?
(Thank you for your help!)

Copy link
Copy Markdown

@tianyi21 tianyi21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

@anacrdeoliveira
Copy link
Copy Markdown
Owner Author

thank you! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants