Hi, I am doing the 11th question Finding The Shortest Session in Working With Dates And Times In Python Practice Problems. The question asked us to go through a list of lists that contains data of the starting and ending points of visiting sessions, and then find the shortest session.
The code I wrote is this:
The provided answer used a different method:
The results are different by a minute, and it seems to be about using datetime.timedelta.min
vs using None
as the placeholder. But I can’t figure out what’s wrong with my code…
Also, the answer used row = [int(x) for x in row]
- what is this method called? I’m at the end of the intermediate python course on Dataquest and it hasn’t been mentioned, so guess I will have to google it. Thanks!