Data Science and Machine Learning Internship ...
- 22k Enrolled Learners
- Weekend/Weekday
- Live Class
A leap year has an additional day which makes the total number of the days in that year as 366. This additional day in the leap year is added in the month of February. A leap year occurs once in every 4 years. This blog will help you implement a Python program to check leap year or not. Below topics are covered:
year = int(input("Enter a year: ")) #Getting value for user if (year % 4) == 0: if (year % 100) == 0: if (year % 400) == 0: print("{0} is a leap year".format(year)) else: print("{0} is not a leap year".format(year)) else: print("{0} is a leap year".format(year)) # Number will be printed as leap year else: print("{0} is not a leap year".format(year)) #Number will be printed as Non Leap Year
Output:
Input value = 1983
Input value = 2000
With this, we come to an end of this blog on “Python program to check leap year”. I hope it added value to your knowledge of Python. To get in-depth knowledge on Python along with its various applications, you can enroll for live Python Certification Training with 24/7 support and lifetime access.
Course Name | Date | Details |
---|---|---|
Data Science with Python Certification Course | Class Starts on 14th December,2024 14th December SAT&SUN (Weekend Batch) | View Details |
edureka.co