Advertisement
vasyukov

ZFTSH Python 3

Mar 26th, 2023
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. ''' Программа, считающая количество интересных високосных годов во второй половине века'''
  2.  
  3. def leap(year):
  4.     if (year % 4 == 0 and year % 100 != 0) or year % 400 == 0:
  5.         return True
  6.     return False
  7.  
  8. def interesting(year):
  9.     if prime(year / 2):
  10.         return True
  11.     return False
  12.  
  13. def prime(number):
  14.     return all(number % divisor != 0 for divisor in range(2, int(number**0.5)+1))
  15.  
  16. count = 0
  17. for year in range(1584, 2024, 2):
  18.     if 50 <= year % 100 <= 99:
  19.         if leap(year) and interesting(year):
  20.             count += 1
  21.  
  22. print(count)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement