Write a python program to generate the next 15 leap years starting from a given year. Populate the leap years into a list and display the list.Write a python program to generate the next 15 leap years starting from a given year. Populate the leap years into a list and display the list.
Answers
Answered by
1
Explanation:
hope you will understand
Attachments:
Answered by
3
Python program to generate the next 15 leap years starting from a given year:
def find_leap_yrs(given_year):
cnt=0
list_of_leap_yrs=[]
while(cnt<15):
if( given_yr%400==0 or given_yr%4==0 and given_yr%100==0):
list_of_leap_yrs.append(given_year)
cnt=cnt+1
given_yr=given_yr+1
return list_of_leap_yrs
list_of_leap_yrs=find_leap_yrs(2014)
print(list_of_leap_yrs)
Similar questions