jeudi 17 septembre 2020

Print leap year for next 15 years from given year of input

I want to print next 15 leap years from the year given as input as my code follows the control is stuck at the loop

def find_leap_years(given_year):
    list_of_leap_years=[]
    condition =given_year+15 
    while(given_year<=condition):
        if(given_year%4==0):
            list_of_leap_years.append(given_year)
        else:
            continue    
        given_year=given_year+1 
    print(list_of_leap_years)    
    

    # Write your logic here

    return list_of_leap_years

list_of_leap_years=find_leap_years(2000)
print(list_of_leap_years)

The expected output is to print leap years for next upcoming 15 year from the given value Thanks in Advance

Aucun commentaire:

Enregistrer un commentaire