cs/Practical File/outputs/question_08_output.txt
Neil Revin 780baf678e
chore: move question & output files
Move python question files to 'questions' directory
Move output files to 'outputs' directory
Copy output files to 'questions' for ease of viewing

Signed-off-by: Neil <neil@willofsteel.me>
2025-06-24 02:34:07 +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.