Commit Graph

2 Commits

Author SHA1 Message Date
Nguyen Thi Thanh Minh
533767ff46
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 <tianyizheng02@gmail.com>

---------

Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
2025-01-17 19:07:44 -08:00
Ron U
c510a7da7b
Add doomsday algorithm (#2903)
* Added doomsday algorithm

* Adding unit-tests to doomsday algorithm

* running black on doomsday

* adding doctest and fixing a black issue [doomsday]

* Update doomsday.py

* fixing black issue [doomsday]

* Update other/doomsday.py

* Update doomsday.py

* adding more doctests (following review comment) [doomsday]

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-10-07 20:22:56 +08:00