Mar-06-2019, 06:39 AM
My last trial! Please, may I have help? Thank you
# ---------- ea2.py --------------- # https://docs.python.org/2/library/datetime.html from datetime import date def calc_easter(self, year): "Returns Easter as a date object." a = year % 19 b = year // 100 c = year % 100 d = (19 * a + b - b // 4 - ((b - (b + 8) // 25 + 1) // 3) + 15) % 30 e = (32 + 2 * (b % 4) + 2 * (c // 4) - d - (c % 4)) % 7 f = d + e - 7 * ((a + 11 * d + 22 * e) // 451) + 114 month = f // 31 day = f % 31 + 1 return date(year, month, day) start_interval= 1950 end_interval= 1960 r = range(start_interval, end_interval+1) for n in r: s=calc_easter(date, n) print(date.month) # my intention is to extract the month number (3 or 4), # same story for the day # and then if condition will solve the matter # -------- OUTPUT ---------- # Where is my fault? # -------------------------- #C:\Training>python ea2.py #<attribute 'month' of 'datetime.date' objects> #<attribute 'month' of 'datetime.date' objects> #<attribute 'month' of 'datetime.date' objects> #<attribute 'month' of 'datetime.date' objects> #<attribute 'month' of 'datetime.date' objects> #<attribute 'month' of 'datetime.date' objects> #<attribute 'month' of 'datetime.date' objects> #<attribute 'month' of 'datetime.date' objects> #<attribute 'month' of 'datetime.date' objects> #<attribute 'month' of 'datetime.date' objects> #<attribute 'month' of 'datetime.date' objects> # ---------------------------------------------