Is This Leap Year? Python Calendar

How To Calculate If The Year Is Leap Year and How Many Days Are In The Month #PurePythonSeries — Episode #05

J3
Jungletronics
3 min readSep 19, 2021

--

Fig 1. Image from What Is a Leap Year? By timeanddate.com

Who determined which months would have 30 or 31 days?

A leap year (also known as an intercalary year or bissextile year) is a calendar year that contains an additional day.

A year that is not a leap year is a common year.

In the Gregorian calendar, each leap year has 366 days instead of 365, by extending February to 29 days rather than the common 28. These extra days occur in each year which is an integer multiple of 4 (except for years evenly divisible by 100, but not by 400). The leap year of 366 days has 52 weeks and two days, hence the year following a leap year will start later by two days of the week. Wikipedia

diagram (draw.io) borrowed from 100 Days of Code: The Complete Python Pro Bootcamp for 2022 Course as taught by Dr. Angela Yu

Why does February 29th only appear on the calendar every 4 years?

It was the Egyptians of Alexandria who, more than 2,200 years ago, had the idea of, every four years, adding an extra day to the calendar, to make up for the remaining six hours (a rounding off from 5:48:46). It’s a perfect day, which every four years appears on the sheet as the 29th of February

what is the year?

What is the mouth?

Now let’s proceed to the calculation:

Until next time!

👉Jupiter notebook link :)

👉or collab link

👉git

Credits & References

Leap year by wikipedia.org

What Is a Leap Year? by timeanddate.com

Book: The Ultimate Crash Course On Python That Will Have You Programming In Just 7 Days! by Oliver R. Simpson

Quem determinou quais meses teriam 30 ou 31 dias? Super Interessante Brazilian Magazine

Related Posts

00#Episode#PurePythonSeries — Lambda in Python — Python Lambda Desmistification

01#Episode#PurePythonSeries — Send Email in Python — Using Jupyter Notebook — How To Send Gmail In Python

02#Episode#PurePythonSeries — Automate Your Email With Python & Outlook — How To Create An Email Trigger System in Python

03#Episode#PurePythonSeries — Manipulating Files With Python — Manage Your Lovely Photos With Python!

04#Episode#PurePythonSeries — Pandas DataFrame Advanced — A Complete Notebook Review

05#Episode#PurePythonSeries — Is This Leap Year? Python Calendar— How To Calculate If The Year Is Leap Year and How Many Days Are In The Month(this one)

06#Episode#PurePythonSeries — List Comprehension In Python — Locked-in Secrets About List Comprehension

07#Episode#PurePythonSeries — Graphs — In Python — Extremely Simple Algorithms in Python

08#Episode#PurePythonSeries — Decorator in Python — How To Simplifying Your Code And Boost Your Function

--

--

J3
Jungletronics

😎 Gilberto Oliveira Jr | 🖥️ Computer Engineer | 🐍 Python | 🧩 C | 💎 Rails | 🤖 AI & IoT | ✍️