SIGN IN SIGN UP
TheAlgorithms / Python UNCLAIMED

All Algorithms implemented in Python

0 0 1 Python

Doomsday Algorithm: Fix leap year check (#12396)

* Fix leap year check

Replace `!=` in `(year % 400) != 0` (line 49) with `==`

Justification: Years that are divisible by 100 (centurian == 100) but not by 400 (year % 400 != 0) are skipped and NOT leap year.

* Update parentheses

Correct the parentheses to make clear the precedence of the conditional check

* Update other/doomsday.py

Co-authored-by: Tianyi Zheng <[email protected]>

---------

Co-authored-by: Tianyi Zheng <[email protected]>
N
Nguyen Thi Thanh Minh committed
533767ff46bbcf5c594ff8196894ae2e8130bc3e
Parent: 0040ad4
Committed by GitHub <[email protected]> on 1/18/2025, 3:07:44 AM