Skip to content

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
@arthurdejong
Copy link
Owner

Thanks. Merged as 8b78f78.

@lucasicr lucasicr deleted the patch-1 branch May 10, 2025 13:19
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