Skip to content

Comments

Bit manipulation: add type hints, validation, doctests; simplify bitw…#13550

Open
Poortigupta wants to merge 2 commits intoTheAlgorithms:masterfrom
Poortigupta:bit_update
Open

Bit manipulation: add type hints, validation, doctests; simplify bitw…#13550
Poortigupta wants to merge 2 commits intoTheAlgorithms:masterfrom
Poortigupta:bit_update

Conversation

@Poortigupta
Copy link

--> Files : binary_and_operator.py, binary_or_operator.py, binary_xor_operator.py, is_even.py
-->Summary:
Add type hints and expanded docstrings with doctests (valid and error cases)
Enforce consistent input validation (TypeError for non-integers; ValueError for negatives where applicable; disallow bools in is_even)
Simplify logic using native bitwise operations and zero-padded formatting
Preserve existing behavior; doctests pass locally

Checklist :
Python 3.14+ compatible
Doctests added and passing locally
No new dependencies
No changes to README.md or DIRECTORY.md

@Poortigupta
Copy link
Author

Is this PR has any issues
Please highlight them or accept the PR.

@algorithms-keeper algorithms-keeper bot added the awaiting reviews This PR is ready to be reviewed label Oct 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants