-
-
Notifications
You must be signed in to change notification settings - Fork 46.7k
Update count_number_of_one_bits.py #7589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
removed the modulo operator as it is very time consuming in comparison to the and operator
Please add a timeit (or similar) benchmark to prove that the proposed code is faster than the original code. |
Updated with the timeit library to compare. Moreover I have updated my code which helps us in reaching the output comparatively faster.
for more information, see https://pre-commit.ci
I have updated my code. It would be great if you could have a look into it. |
Co-authored-by: Christian Clauss <[email protected]>
I have updated the code as suggested. |
Please run this on your own machine. The doctest fails. |
Updated the code
I am extremely sorry for the silly mistakes. Please could you check it now |
Would it be more self-documenting to change the variable Let's make
|
I guess the variable name "number" is more appropriate as it's representing the number which the user will be providing as the input and not the bit_length. |
Updated code
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome contribution. Thanks for doing this!!
for more information, see https://pre-commit.ci
Hi could you please add a label of hacktoberfest-accepted. |
Thank you. |
removed the modulo operator as it is very time consuming in comparison to the and operator
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}
.