title: Finding the mode of a list using ONLY loops and creating lists in python
body: <p>I have been trying to figure out how to find the mode of a list <strong>WITHOUT</strong> using sorting functions nor importing any modules for quite awhile now... Here's what I have so far:</p>
  
  <pre><code>d = {}
  def mode():
      for i in mode:
          if i in d:
              d[i] += 1
          else:
              d[i] = 1
      return
  </code></pre>
  
  <p>How do I find the output such as the following:</p>
  
  <pre><code>print(mode([1, 5, 6, 1, 1, 2]))
  [1]
  print(mode([5, 6, 7, 8, 9]))
  [5, 6, 7, 8, 9]
  </code></pre>
  
  <p>Thanks a bunch!</p>