Change the date_range function to return a list of all dates between start and end in list def date_range(start_date, end_date): lst = [] if start_date > end_date: return [] else: try: start = (dt.strptime(start_date, '%Y-%m-%d')) end = (dt.strptime(end_date, '%Y-%m-%d')) lst.append(start.strftime('%Y-%m-%d')) start += td(days=1) return lst except: return [] Examples: Input: date_range('2022-12-01', '2022-12-05') Output: ['2022-12-01', '2022-12-02', '2022-12-03', '2022-12-04', '2022-12-05']
def date_range(start_date, end_date): lst = [] if start_date > end_date: return [] else: try: start = (dt.strptime(start_date, '%Y-%m-%d')) end = (dt.strptime(end_date, '%Y-%m-%d')) lst.append(start.strftime('%Y-%m-%d')) start += td(days=1) return lst except: return []