title: Need to stop printing Counter() after a certain amount of items have been printed
body: <p>Trying to write a program that prints the <em>n</em> most common items in a list depending on how many the user wants to see, and prints more if the last items have the same frequency.</p>
  
  <p>This is what i have written:</p>
  
  <pre><code>num = int(input("Enter Number"))
  i = 0
  wordsInList = [word1, word2, word2, word3, word1]
  catagory = Counter(list)
  catagory.keys()
  for key, value in catagory.items(): #set the frequency to value and word to key
      if i &lt;= num or lastValue == value: #(Issue with code)If the required number of values have been printed, stop printing
          print('{:&lt;5d}{:&lt;15s}'.format(value, key)) 
          lastValue = value
          i =+ 1
  </code></pre>
  
  <p>The problem with this is that as soon as that print statement is run, it prints all lines of the <em>count()</em>.</p>
  
  <p>Example would be if the user only wanted to print the most common value:</p>
  
  <pre><code>n = 1
  </code></pre>
  
  <p>most common value would be a tie between <em>word1</em> and <em>word2</em> - as they both appear twice. So the output would be</p>
  
  <pre><code>2  word1
  2  word2
  </code></pre>
  
  <p>If the user was to enter <em>n = 2</em>, the output would be the same, as they are the 2 most common words. However if the user entered <em>n=3</em>, below would be the output:</p>
  
  <pre><code>2  word1
  2  word2
  1  word3
  </code></pre>