title: What does "count.get" mean in Leetcode 347. Top K Frequent Elements
body: <p>In the solution of the problem (Leet code 347. Top K Frequent Elements)</p>
  <p>Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order.</p>
  <pre><code>from collections import Counter
  class Solution:
      def topKFrequent(self, nums: List[int], k: int) -&gt; List[int]:  
          if k == len(nums):
              return nums
          
          count = Counter(nums)   
          return heapq.nlargest(k, count.keys(), key=count.get) 
  </code></pre>
  <p>I cannot understand what</p>
  <pre><code>key=count.get
  </code></pre>
  <p>means at the last line.</p>
  <p>When the input is</p>
  <pre><code>nums = [1,1,1,2,2,3], k = 2
  </code></pre>
  <p>the answer should be</p>
  <pre><code>[1,2]
  </code></pre>
  <p>If I cut</p>
  <pre><code>key=count.get
  </code></pre>
  <p>from the last line,
  the output would be</p>
  <pre><code>[3,2]
  </code></pre>
  <p>Could anyone teach me what &quot;count.get&quot; does?</p>