livepython.net

66. Python Program to Check If a Year Is a Leap Year

Mediumand, or, not

Overview

Combine and and or, with brackets.

Problem Statement

Read a year. A year is a leap year if it divides by 4 but not by 100, or if it divides by 400. Print the result like this, for 2024:

2024 is a leap year

Use input() with no prompt text: the tests type the input for you, and a prompt would end up in your output.

Input

One value per line, in this order. Example:

2024

Output

The output for that example:

2024 is a leap year

The tests try 4 different inputs.

Learn this firstChapter 8 · Python Logical Operators: and, or, not
solution.py
# write your code here

EXPECTED OUTPUT

12024 is a leap year

YOUR OUTPUT

Press Run to see your output here. Lines are compared with the expected output.