Advertisement
alex_doan_

Untitled

Dec 10th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #Indent the code as per given in the above screenshot.
  2.  
  3. #Run the code in python version 3.x.
  4.  
  5.  
  6.  
  7. #Define the function to
  8.  
  9. #identify the leap year.
  10.  
  11. def leap_year(string):
  12.  
  13.  
  14.  
  15. #Convert the string
  16.  
  17. #in the integer.
  18.  
  19. year = int(string)
  20.  
  21.  
  22.  
  23. #Check the year to be leap year or not.
  24.  
  25. if year % 4 == 0 and (year % 100 != 0
  26.  
  27. or year % 400 == 0):
  28.  
  29.  
  30.  
  31. #If the above condition will
  32.  
  33. #be true then return true.
  34.  
  35. return True
  36.  
  37.  
  38.  
  39. #The else part.
  40.  
  41. else:
  42.  
  43.  
  44.  
  45. #If the above condition will not
  46.  
  47. #be true then return false.
  48.  
  49. return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement