Python Practice Lab
easyUnit 4 · Control Flow: if-elif-else, match-case

P10. Leap Year

Control Flow: if-elif-else, match-case

A year is a leap year if it is divisible by 400, or if it is divisible by 4 but not by 100. Read a year and print whether it is a leap year, and how many days February has in that year.

Input Format

  • Line 1: year

Output Format

  • Line 1: Leap year or Not a leap year
  • Line 2: February has <28 or 29> days

Constraints

  • 1 ≤ year ≤ 9999

Sample Test Cases

Sample 1
Input
2024
Output
Leap year
February has 29 days
Sample 2
Input
1900
Output
Not a leap year
February has 28 days

Submitting checks 2 sample cases and 4 hidden test cases.

Hints

Saved
Custom 1

This is your own input, so Run will show what your program prints but can't say whether it's correct.