cs/practical-file/outputs/question_08_output.txt
2025-06-24 02:37:47 +05:30

19 lines
402 B
Plaintext

Question 08:
Write a Python program to check whether a given year is a leap year or not.
Answer:
def main(year: int) -> None:
if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
print(f"{year} is a leap year.")
else:
print(f"{year} is not a leap year.")
if __name__ == '__main__':
main(2020)
main(2021)
Output:
2020 is a leap year.
2021 is not a leap year.