title: Count amount of specific values in list?
body: <p>i am trying to count the 'a's in a given x list but this code is wrong and i cant figure out why</p>
  
  <pre><code>x = ['a', 'b', 'a']
  
  def a_count(x):
      n = 0
      for ltr in x:
          if ltr == 'a':
              n = n + 1
          else :
              n = n
          return n
      return 
  </code></pre>
  
  <p>i would also appreciate if someone could show me how to count the 'a's from another list that the user sets the values. this can be done by setting an empty  list like</p>
  
  <pre><code>y = []
  </code></pre>
  
  <p>and...then?</p>