title: dictionary in python sum prices with 2 inputs
body: <p>I have 2 inputs:</p>
  <pre><code># The key is the available dates and the value is the price
  a = {&quot;g&quot;: 109192, &quot;e&quot;: 116374, &quot;o&quot;: 183368, &quot;s&quot;: 162719}
  
  # The dates that the user wants to take, this is going to be input by the user separeted by a space
  b = (&quot;g&quot;, &quot;n&quot;, &quot;e&quot;, &quot;k&quot;, &quot;s&quot;)
  </code></pre>
  <p>The program has to tell the user total cost of the dates and which one is available.</p>
  <p><strong>Output:</strong></p>
  <pre class="lang-none prettyprint-override"><code>388285
  g e s
  </code></pre>
  <p>My code so far:</p>
  <pre><code>import json
  a=input(&quot;&quot;)
  b=list(input().split(' '))
  dic=json.dumps(a)
  def citas(dic,b):
    citas_disponibles=[]
    suma=0
    for dia in b:
      if dia in a:
        suma += a[dia]
        citas_disponibles.append(dia)
    return citas_disponibles
  citas(dic,b)
  </code></pre>
  <h1>but the &quot;suma&quot; generate an &quot;error&quot;</h1>