Write a Python code to check whether a given year is a leap year or not.
Advertisements
Advertisements
Question
Write a Python code to check whether a given year is a leap year or not.
Short/Brief Note
Advertisements
Solution
n = int (input(“Enter any year”))
if (n % 4 = = 0):
print “Leap year”
else:
print “Not a Leap year”
Output:
Enter any year 2001
Not a Leap year
shaalaa.com
Introduction to Python Functions
Is there an error in this question or solution?
APPEARS IN
RELATED QUESTIONS
A named block of code that is designed to do one specific job is called ______
A Function which calls itself is called as ______
Write the different types of functions.
How to set the limit for recursive function? Give an example.
Differentiate ceil() and floor() function?
What are the points to be noted while defining a function?
Explain the different types of functions with an example.
Write a Python code to find the L.C.M. of two numbers.
Explain the following built-in function.
type()
Explain the following built-in function.
pow()
