Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Leap Year Code
00:00
5 left

Leap Year Code

EasyPython

Problem

Code to determine if a given year is a leap year.

Implement is_leap_year(year) and return a Boolean: True when the year is a leap year and False otherwise. Apply the Gregorian calendar rules, with an input year from 1 through 9999.

Constraints

  • 1 <= year <= 9999
  • Use Gregorian calendar rules
  • Return a Boolean value

Function Signature

def is_leap_year(year):
Interviewer

Your question is Leap Year Code. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePython 3
You need to log in / sign up to run or submit.Ln 2
Run your code to see test output here.