title: Sorting a concordance?
body: <p>For my homework, I need to isolate the most frequent 50 words in a text. I have tried a whole lot of things, and in my most recent attempt, I have done a concordance using this: </p>
  
  <pre><code>concordance = {}
  
  lineno = 0
  
  for line in vocab:
  
      lineno = lineno + 1
  
      words = re.findall(r'[A-Za-z][A-Za-z\'\-]*', line)
      for word in words: 
          word = word.title()
          if word in concordance:
              concordance[word].append(lineno)
          else: 
              concordance[word] = [lineno]
  listing = []
  
  for key in sorted(concordance.keys()):
  
      listing.append( [key, concordance[key] ])
  </code></pre>
  
  <p>What I would like to know is whether I can sort the subsequent concordance in order of most frequently used word to least frequently used word, and then isolate and print the top 50? I am not permitted to import any modules other than <code>re</code> and <code>sys</code>, and I'm struggling to come up with a solution. </p>