Facebook
From Sweet Anoa, 3 Years ago, written in Python.
">

A PHP Error was encountered

Severity: Notice

Message: Trying to access array offset on value of type bool

Filename: view/view.php

Line Number: 33

from

A PHP Error was encountered

Severity: Notice

Message: Trying to access array offset on value of type bool

Filename: view/view.php

Line Number: 33

- view diff
Embed
Download Paste or View Raw
Hits: 41
  1. def compare_dates(y1, m1, d1, y2, m2, d2):
  2.     if (y1, m1, d1) == (y2, m2, d2):
  3.         return 0
  4.  
  5.     elif (y1, m1, d1) < (y2, m2, d2):
  6.         return -1
  7.  
  8.     elif (y1, m1, d1) > (y2, m2, d2):
  9.         return 1
  10.  
  11.  
  12. def test_compare_dates():
  13.     assert compare_dates(2020, 9, 26, 2020, 9, 26) == 0
  14.     assert compare_dates(2020, 9, 25, 2020, 9, 26) == -1
  15.     assert compare_dates(2020, 9, 27, 2020, 9, 26) == 1
  16.  
  17.     assert compare_dates(2020, 9, 26, 2020, 10, 26) == -1
  18.     assert compare_dates(2020, 9, 26, 2020, 8, 26) == 1
  19.  
  20.  
  21. if __name__ == '__main__':
  22.     test_compare_dates()
  23.     name = 'Гудебский Данил'  # TODO: напишите Ваше имя
  24.     print(f'26 сентября - {name}')
  25.