Skip to content

Deleteding superfluous modulus operation #470

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lucasicr
Copy link
Contributor

@lucasicr lucasicr commented May 5, 2025

Since -(x % 11) % 11 and -x % 11 give always the same result, the first modulus operation can be safely deleted.

In the same way in the following code, the modulus in the fist line can be deleted with no effect on the output:

    s = sum(w * int(n) for w, n in zip(weights, number)) % 11
    return str(-s % 11 % 10)

Deleted superfluous modulus operation
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.

1 participant