Most years have 365 days. However, the time required for the Earth to orbit the Sun is actually slightly more than that. As a result, an extra day, February 29, is included in some years to correct for this difference. Such years are referred to as leap years.
The rules for determining whether or not a year is a leap year follow:
Any year that is divisible by 400 is a leap year.
Of the remaining years, any year that is divisible by 100 is not a leap year.
Of the remaining years, any year that is divisible by 4 is a leap year.
All other years are not leap years.
Write a program that reads a year from the user and displays a message indicating
whether or not it is a leap year.
Year=int(input('Enter the Year: ')) if (Year%400==0) and (Year%100!=0): print("{} is a leap year".format(Year)) elif (Year%4==0): print("{} is a leap year".format(Year)) else: print("{} is not a leap year".format(Year))
INPUT:
Enter the Year: 2016
OUTPUT:
2016 is a leap year
More Codes to Fcuk
- Alphabet pyramid
- Find prime numbers between lower and upper ranges
- Prime Factor
- Find the sum of positive even numbers
- An integer interval [a,b], Find the minimum size of a set S.
- Country A and B, how many years the population of A surpasses B.
- Identify pH level
- Find the Perfect Number
- Find out if a word is a palindrome or not
- Find next Palindrome of N number.
- The writing bot Question. A scientist has created a writing bot. Read and write activity needs to be captured.
- Total Number of Odds in the list
- Partition this string into as many parts as possible.
- Leap year
- LCM of two numbers
- Greatest of three numbers
- Find the Gravitational Force Acting Between Two Objects.
- Find the missing element in geometric progression
- Find the GCD Greatest common divisor
- convert a given float number to integer