title: how to loop through a dictionary as a range
body: <p>I have a dictionary with key a start time o a video and its value as end time. each key value pair represents different group. how to check a number exists in range.
  eg:</p>
  
  <pre><code>dictvid = {146: 209, 509: 539, 0: 145, 304: 320}
  </code></pre>
  
  <p>from 0 to 539 - 210 to 303 and 321 to 508 needs to be in another dictionary
  i.e </p>
  
  <pre><code>newgroup = {210:303,321:508}
  </code></pre>