title: Can I write codes to count the frequency of each integer, and then print each integer with its frequency?
body: <p>Given a list of integers:
  Write codes to count the frequency of each integer, and then print each integer with its frequency. (The order of the elements does not matter)
  For example, for <code>n = [1,1,1,3,3,3,2,2,4,4,4,4,4,5,5,5,6,6,6,6,6,6,6,6,6]</code>, the print out will be:</p>
  
  <pre><code>1 3
  2 2
  3 3
  4 5
  5 3
  6 9
  </code></pre>
  
  <p>And make each two numbers in a row.
  i.e. in the first row, 3 is the frequency of 1 in the list n</p>
  
  <p>My code is like that, and it shows 'builtin_function_or_method' object is not subscriptable:</p>
  
  <pre><code>n = [1,1,1,3,3,3,2,2,4,4,4,4,4,5,5,5,6,6,6,6,6,6,6,6,6]
  
  def question_7_1(n=n):
      count=0
      for i in n:
          if i==n.index[i]:
              count=count+1
              print(i,count)
  </code></pre>