self learning python and been stuck trying to figure this out.
Trying to output both the day before and the day after a given date without using the date.time module.
script so far:
Trying to output both the day before and the day after a given date without using the date.time module.
script so far:
#!/usr/bin/env python3 ####enter date in yyyymmdd format def dbda(today): if len (today) != 8: return '00000000' else: year = int(today[0:4]) month = int(today[4:6]) day = int(today[6:]) ####calculate leap year lyear = year % 4 if lyear == 0: feb_max = 29 else: feb_max = 28 lyear = year % 100 if lyear == 0: feb_max = 28 lyear = year % 400 if lyear == 0: feb_max = 29 next_day = day + 1 #tomorrow pass_day = day - 1 #yesterday mon_max = { 1:31, 2:feb_max, 3:31, 4:30, 5:31, 6:30, 7:31, 8:31, 9:30, 10:31, 11:30, 12:31}