Leap year in python full explanation for beginners | Python Bootcamp

Introduction

In this post, you will learn how to find leap yearn and non-leap year n python. This topic is quite complicated for beginners, So stick with me by clicking the youtube video I mand below.

Video:

Leap year in python

The leap year comes every 4 years once. So, obliviously the number divisible by 4 will be a leap year and we should also sort out the non-leap years.

The number which is divisible by 100 is a non-leap year and a number that is divisible by 400 is a leap year.

I know that you got confused.

Firstly, we knew that every 4 years leap year comes, So any number divisible with 4 will be a leap year.

Secondly, The number 100 comes in to sort out the non-leap years.

Finally, The 400 also is very similar to the 4, any number which is divisible by 400 will be a leap year.

Take a look at the flow chart below, So you will get an idea.

leap year in python

Leap year python code ????????

Just try the below code and see if it is running.

https://gist.github.com/moulik-source/83cb3d2967d4992dd03710329cbcb6cd

Click here to run the code ????????


Also Read: Elif full explained in python

Also Read: Dirbuster full tutorial