Python Online Compiler
Example: Leap Year Program in Python using If else Statement
C
C++
C#
Java
Python
PHP
main.py
STDIN
Run
# Leap Year Program in Python using If else Statement y = None # y - denotes the year print ("----Enter the year----") y = int (input ()) if y % 400 == 0: print("\n", y, " is the leap year.") elif y % 100 == 0: print ("\n", y, " is not the leap year.") elif y % 4 == 0: print ("\n", y, " is the leap year.") else: print ("\n", y, " is not the leap year.")
2008
Output
Clear
ADVERTISEMENTS