AyanUpadhaya

Check Leap Year In Python

May 20th, 2021 (edited)
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. #checks if the year is a leap year
  2.  
  3. #if year is divisible by both 4 and 400
  4.  
  5. #and checks if year is divisible by 100 but remainder not equal to 0
  6.  
  7.  
  8. year_list=[1992,1993,2000,2007,2014,2022,2024]
  9.  
  10. for year in year_list:
  11.     if ((year%400==0) or (year%4==0) and (year%100!=0)):
  12.         print(f'{year} is a leap year')
  13.     else:
  14.         print(f'{year} is not a leap year')
Add Comment
Please, Sign In to add comment