🐍Python Program #14: Check if a Year is a Leap Year | Python Programming
📅 Is it a leap year or not? Learn how to check it using Python in a few easy steps! This program is beginner-friendly and explains the logic clearly with real-world examples.
🎯 You'll Learn:
Leap year rules
if-else statements in Python
Clean input/output structure
Logic:
1. Ask the user to enter a year → e.g., 2024
2. A year is a leap year if:
✅ It's divisible by 4
❌ Except years divisible by 100 (they’re not leap years)
✅ But if divisible by 400, it's a leap year again!
3. Example:
2000 is a leap year (divisible by 400)
1900 is not a leap year (divisible by 100 but not 400)
2024 is a leap year (divisible by 4 and not 100)
4. Use if-elif-else statements to check the condition.
5. Print result accordingly.
Code:
Check if a year is a leap year
year = 2024
if (year % 4 == 0):
if (year % 100 == 0):
if (year % 400 == 0):
print(f"{year} is a leap year.")
else:
print(f"{year} is not a leap year.")
else:
print(f"{year} is a leap year.")
else:
print(f"{year} is not a leap year.")
👉 Perfect for Python beginners and school/college projects!
📌 More Python Tutorials (Subscribe to stay updated!):
👉 Python in 5 Minutes: Super Fast Beginner Guide
• Python in 5 Minutes: Super Fast Beginner G...
👉 Python Variables and Data Types | Explained in 3 minutes with Examples | Python for Beginners
• Python Variables and Data Types | Explaine...
👉 Master Python Loops (For loop & While loop) in Just 5 Minutes | Python For Beginners
• Master Python Loops (For loop & While loop...
💻Coding Python Calculator Program 🧮🐍
• 💻Coding Python Calculator Program 🧮🐍
👉 How to Check If List is Empty in Python 🐍💻
• How to Check If List is Empty in Python 🐍💻
👉 How to Reverse a String in Python Like a Pro!
• How to Reverse a String in Python Like a Pro!
👉 Python Lists | 5 Cool Tricks of Lists in Python - You must know!
• 5 Cool Tricks To Use Lists in Python - You...
👉 Python Programs | Python Programming - Playlist for logic building and practice
• Python Programs | Python Programming - Pla...
💡 If this helped you, don’t forget to Like 👍,🔔
Subscribe for more Python tips and tutorials!
Drop a comment below with your favorite input trick!
#Python #LeapYearPython #PythonForBeginners #PythonProjects #BeginnerPython #PythonLogic #LeapYearCheck
On this page of the site you can watch the video online 🐍Python Program #14: Check if a Year is a Leap Year | Python Programming with a duration of hours minute second in good quality, which was uploaded by the user All In Graphics 21 August 2025, share the link with friends and acquaintances, this video has already been watched 208 times on youtube and it was liked by 8 viewers. Enjoy your viewing!