Interesting start to what seems a very useful utility. Future improvements could improve console calendar-style formatting for much easier reading, or a desktop or web UI.
YYYY,MM,DD format is unusual. A slight adjustment to use hyphens instead of commas will bring it in line with ISO 8601 which will be more familiar, I think, to users. Or if you don’t want to use that, you should use your locale’s own date format, whatever that may be.
You should separate your
Enter trip start and end date into two separate
Don’t do this:
visa_start_input_split = visa_start_input.split(",") visa_start = date(int(visa_start_input_split(0)), int(visa_start_input_split(1)), int(visa_start_input_split(2)))
timedelta(days=365) is not accurate, and unfortunately there’s no easy built-in way to do this right.
dateutil will do the trick.
I haven’t taken the time to understand your algorithm, but mutating your trip data here:
trip(0) += timedelta(days=1)
is not a good idea, and you should find some other way that preserves the trip data as immutable. If you’re able to make it immutable, then this:
for trip in planned_trips:
for trip_start, trip_end in planned_trips: