What Makes The Best Desk for Your Office A blog about the best desks for offices. http


The leap year program in python is one of the best ways to get started learning programming. It is a language that has been around for more than two decades and it has a strong community. The Python Software Foundation (PSF) is an organization that provides support for the free open-source software. This includes Python, Jython, IronPython, Psyco, PyPy and Stackless Python.

Python is a high-level programming language used for general purpose programming. Python was created by Guido van Rossum in 1989 as he was looking for a project to keep him occupied during Christmas week. Python is also an interpreted language like Perl or Ruby and is often compared with those languages because it combines remarkable power with very clear syntax. Python runs on Windows, Linux/Unix, Mac OS X and many other platforms.

It is easy to learn: Python has few keywords, simple structure and a clearly defined syntax. This allows the student to pick up the language quickly.

It is powerful: Like Perl, Python source code is available under the GNU General Public License (GPL). This means that it can be freely used and distributed, even for commercial use.

Leap year program in Python

The program to ask the user for a year and checks whether it is leap year or not using the if … else statement.

The python program which takes one input as number and gives output as true or false. A leap year is exactly divisible by 4 except for century years (years ending with 00). The century year is a leap year only if it is perfectly divisible by 400. For example,

2017 is not a leap year 1900 is not a leap year 2012 is a leap year 2000 is a leap year

Leap years occur, as you might know, every four years. The Gregorian calendar is based on the year Jesus was born. Because of this, there are years divisible by 4 that are not leap years. For example 1700, 1800, and 1900 were not leap years because they are divisible by 100 and not 400.

The Gregorian calendar was invented in 1582 and it replaced the Julian calendar which had a leap year every 4 years. The new calendar made some adjustments to the formula for determining when a year is a leap year so that century years (divisible by 100) would not be confused with quadricentennial years (divisible by 400).

By 3200 there will be 97 leap years instead of 96 between the years 1600 and 3200 in the Gregorian calendar which will make the average year 365.2425 days long instead of 365.2422 days as it is now. These adjustments needed to be made because the earth does not circle around the sun in exactly 365 days 5 hours 48 minutes and 45 seconds.*

In this tutorial, we’ll go through how to make a simple command-line calculator program in Python 3. The program will first prompt the user for an operation (+, -, *, or /) and then ask for the numbers.

Creating Our Calculator Program

We’ll be using the file name calc.py to save our program. We could use any name as long as it ends with .py since that’s what makes it a Python file. Create the file and the write out the following code:

def is_leap(year):

leap = False

if (year % 4) == 0:

if (year % 100) == 0:

if (year % 400) == 0:

leap = True

else:

leap = False

else:

leap = True

return leap

if __name__ == ‘__main__’:

year = int(input())

print(is_leap(year))


Leave a Reply

Your email address will not be published. Required fields are marked *