Python Competitive Programming Questions |
In this article, We are going to write a python code to check if the input year is leap year or not.
If you are looking for a Python Tutorial then it's here
def CheckYear(year):
if (year%4 == 0) and (year%100 != 0) or (year%400 == 0):
print(year, ' is a leap year')
else:
print(year, ' is not a leap year')
def main():
year = int(input('Enter the number of rows: '))
CheckYear(year)
main()
The output of the code is:
Enter the number of rows: 2021
2021 is not a leap year
Enter the number of rows: 2000
2000 is a leap year
Enter the number of rows: 2019
2019 is not a leap year
Comments
Post a Comment