title: Recursively going through list and compare with a value (python)
body: <p>The task is to go through a list, compare it with a value and then return the amount of times the value occurred. The comparison works and when I find the matching value I want to save it in a list. Then I want to get the length of that list. The problem is that every time i call on the function again the list resets, how do I avoid that? </p>
  
  <pre><code>    def count_occurences(values, value):
          matched_values = []
          if values:
              if values[0] == value:
                  matched_values.append(values[0])
                  count_occurences(values[1:], value)
              else:
                  count_occurences(values[1:], value)
          else:
              return 0
          return len(matched_values)
      count_occurences([1, "one", 2, "two", "two", 3, "three", "three", "three"], "two")
  </code></pre>
  
  <p>In this case the expected output would be: 2.</p>