Jungletronics
Published in

Jungletronics

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

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

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?

current_year = int(input("Enter the Year: "))Enter the Year: 1963

What is the mouth?

month = int(input("Enter the Month: "))Enter the Month: 1

Now let’s proceed to the calculation:

print("I hope you enjoyed that lecture o/\nIf you find this post helpful, please click the applause button and subscribe to the page for more articles like this one.\nHave a Nice Day!")I hope you enjoyed that lecture o/
If you find this post helpful, please click the applause button and subscribe to the page for more articles like this one.
Have a Nice Day!

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 Brasilian 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

--

--

--

J of Jungle + 3 Plats Arduino/RPi/Pic = J3

Recommended from Medium

Basic Linux Commands

The Implicit Information Hypothesis

As Tusam would say: “It can fail!”

Working with AWS CLI

Development of features using Agile Methodology

I started using Bitdoubler and i love it

Range Sum Query 2D — Immutable Leetcode Solution

Range Sum Query 2D - Immutable Leetcode Solution

Improving web accessibility one small change at a time — Global Accessibility Awareness Day

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
J3

J3

Hi, Guys o/ I am J3! I am just a hobby-dev, playing around with Python, Django, Lego, Arduino, Raspy, PIC, AI… Welcome! Join us!

More from Medium

PYTHON IN WEB DEVELOPMENT

Classes in Python

Make Your Python Program Speak!

If coding in python