Foundations Chapter 1: Accumulators
Lesson 1: The Art of Accumulation
0/7 tasks

Trouble in the Village

Village

In the peaceful village of Recurshima, life thrived under a harmonious blend of tradition and technology. The villagers relied on intricate code to run their daily lives—cultivating crops, preserving knowledge, and staying connected with one another. But one fateful day, a mysterious digital plague began corrupting this code.

Leap Year Checker

The village's sacred calendar has been corrupted by the digital plague, causing its leap year calculations to fail. Farmers have planted crops at wrong times and festivals have been celebrated on incorrect dates. Village Elders have called for someone to step forward and fix the calendar's code to restore order to the village's timekeeping.

Find the bug in the leap year checker function and fix it.

What is a leap year?

  1. A year is a leap year if it is divisible by 4.
  2. It is not a leap year if it is divisible by 100 unless it is also divisible by 400.

Examples:

is_leap_year(2000) -> "Leap Year"
is_leap_year(1900) -> "Not a Leap Year"
is_leap_year(2004) -> "Leap Year"

The Elders suspect that the plague might have tempered with the numbers. Review the values used in the conditions and see if they are correct.

Leap Year Checker