Finding and comparing the minimum timedelta of 2 datetime lists python
<p>I have 2 lists containing <strong>datetime.timedelta</strong> values.
Need help finding the minimum of both lists and comparing them to find out which is greater.</p>

<p>Note: I am fairly new to Python</p>

<p>This is the first list, extracting datetime values from dicts v,w:</p>

<pre><code>for y in range(len(v)):
    try:
            gap.append(v[y]-w[y])
    except:
            print "End of list"
</code></pre>

<p>And this is the second list, calculating intervals within dict values:</p>

<pre><code>for y in range(len(v)):
    try:
            comp.append(v[y]-v[y+1])
    except:
            print "End of list"
</code></pre>

<p>I want to be able to do this:</p>

<pre><code>if min(comp)&lt;min(gap):
    print "Anomaly detected"
else:
    print "Looks good"
</code></pre>

<p>you can use max and min to find out    </p>

<pre><code>w = [datetime.timedelta(10), datetime.timedelta(9), datetime.timedelta(0)]
v = [datetime.timedelta(11), datetime.timedelta(12), datetime.timedelta(13)]
max(min(v),min(w))

datetime.timedelta(11)
</code></pre>

python python-2.7 datetime timedelta