数字と時間の重なりを検出するためにこれを書いたので、今度は同じ曜日にチェックする機能を追加したいが、この条件を何も追加しようとしなかった印刷されます。時間と日付が重複する
intervals = [[100,200, "M", "math"],[100,200, "T", "calc"], [150,250, "M", "eng"],[300,400, "W", "design"], [50,250, "T", "bio"]]
# s = start e = end d = day
overlapping = [ [s,e,d] for s in intervals for e in intervals for d in intervals if s is not e and s[1]>e[0] and s[0]<e[0] and d[1] == d[0] or s[0]==e[0] and s[1]==e[1] and d[1] == d[0] and s is not e]
for x in overlapping:
print '{0} overlaps with {1}'.format(x[0],x[1])
'''
expected:
[100,200, "M", "math"] overlaps with [150,250, "M", "eng"]
[100,200, "T", "calc"] overlaps with [50,250, "T", "bio"]
'''
私のロジックに何が間違っていますか?