I have a list of time entries (HHMM format) with a start time and a stop. I\'m having trouble figuring out how to code it in Python where it returns if there\'s an overlap o
Simple way to do it:
I change the number into string since entry 3 contains 0900, which is invalid.
entry01 = ('1030', '1245')
entry02 = ('1115', '1300')
entry03 = ('0900', '1030')
entry04 = ('1215', '1400')
def check(entry01, entry02):
import itertools
input_time_series = list(itertools.chain.from_iterable([entry01, entry02]))
if input_time_series != sorted(input_time_series):
return False
return True
>>> check(entry01, entry02)
False
>>> check(entry03, entry04)
True