0% found this document useful (0 votes)
293 views3 pages

CYB 130 Week 4 Python LAB 5.21 Leap Year - Functions

The document advertises providing complete course papers and assignments for $150, including up to 5 papers, 1 discussion question response, and 1 quiz. It provides an email address to contact for this service.

Uploaded by

CHRIS D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
293 views3 pages

CYB 130 Week 4 Python LAB 5.21 Leap Year - Functions

The document advertises providing complete course papers and assignments for $150, including up to 5 papers, 1 discussion question response, and 1 quiz. It provides an email address to contact for this service.

Uploaded by

CHRIS D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Don’t have Time to write your papers

We can provide complete course New Papers


at just $150 (upto 5 Papers + one DQ
Response +Quiz)
 

You can submit the papers without any changes


 
Just email us at [email protected]

def is_leap_year(year):

if(year % 400 == 0):

return True

elif year % 100 == 0:

return False

elif year%4 == 0:

return True

else:

return False

if __name__ == '__main__':

n = int(input())

if(is_leap_year(n)):

print(n,"- leap year")

else:

print(n, "- not a leap year")


Code 2

# Define a function to compute

# is leap year or not

def isleapyear(year):

# Chek the leap year condition

    if(year % 400 == 0):

        return True

    elif year % 100 == 0:

        return False

    elif year%4 == 0:

        return True

    else:

        return False

# Create a main function

if __name__ == '__main__':

   # ask from the input

    n = int(input())

    # call the function an decide is leap year

    # or not

    if(isleapyear(n)):

        print(n," is a leap year")

    else:

        print(n, "is not a leap year")


Code 3
is_leap_year = False

input_year = int(input())

if(input_year % 400 == 0):

is_leap_year = True

elifinput_year % 100 == 0:

is_leap_year = False

elif input_year%4 == 0:

is_leap_year = True

if(is_leap_year):

print(input_year,"- leap year")

else:

print(input_year, "- not a leap year")

You might also like