title: Fastest way to sum up in a dictionary with specified (and ordered) keys
body: <p>What is the fastest way to sum up values in a dictionary, where you need to specify the keys (so not sum the entire values of the dictionary).</p>
  <p>For example, let's say I have the following dictionary:</p>
  <pre><code>dict_1 = {1: 128, 2: 134, 3: 45, 4: 104, 5: 129}
  </code></pre>
  <p>and I want to sum up the values in keys 3 through 5.
  In this example, the result is <code>45+104+129 = 278</code>.</p>
  <p>How can I do this as fast as possible?</p>
  <p>Here is what I have tried so far:</p>
  <pre><code>m = 3
  s = 5
  summation = 0.
  while m &lt;= s:
      summation += dict_1[m]
      m += 1
  </code></pre>
  <p>It works, but I'm looking for a faster way.</p>