49.2k views
5 votes
Write a python program

A year with 366 days is called a leap year Leap years are necessary to keep the calendar synchronized with the sun because the earth revolves around the sun once every 365.25 days. Actually, that figure is not entirely precise, and for all dates after 1582 the Gregorian conection apples. Usually years that are divisible by 4 are leap years (for example, 1996). However, years that are divisible by 100 (for example, 1000) are not leap years, but years that are divisible by 400 are leap years (for example, 2000), White a program that asks the user for a year and computes whether that year is a leap year. Use a single if statement and Boolean operators

User Wdphd
by
8.2k points

1 Answer

6 votes

Answer:

Enter a year: 1989

Given the year 1989, is not a leap year

Step-by-step explanation:

Python program for the question is as follows:

yr = int(input(" Enter a year: ")) #enter the value of the year

if (yr%4==0 and yr%100==0 or yr%400==0): #leap year condition

print("Given year{0}, is a leap year".format(y))

else: #else condition

print("Given year{0}, is not a leap year".format(y))

User Wishart
by
7.6k points