title: Return dictionary from function
body: <p>I've been searching stackoverflow for a few hours now without finding a solution to my problem. I have a function where I want the output to be a dictionary, but I can only get it to print the first key + value. The "yield" statement won't work for some reason, so I'm wondering if there is another way to do it. </p>
  
  <p>This is my code:</p>
  
  <pre><code>def myfunc(somedict):
      x = list(somedict.values())      
      for i in x:
          data = dict_from_otherfunc(i)
          mylist = [float(max(data.values()))]
          mydict = dict(zip([i], mylist))
          return mydict
  </code></pre>
  
  <p>This returns a dictionary that looks like this:</p>
  
  <pre><code>{'abc': 1}
  </code></pre>
  
  <p>When I put print instead of return I get the desired output. How can i make this code return a dictionary with all values instead of only one? </p>
  
  <p>Edit:
  Tried returning outside of for-loop, this returns only the <em>last</em> value of my dictionary. </p>