count a character(both uppercase and lowercase) in a string, using a for loop in python
<pre><code>def eCount (s):

    """Count the e's in a string, using for loop.

    Params: s (string)
    Returns: (int) #e in s, either lowercase or uppercase
    """

    # INSERT YOUR CODE HERE, replacing 'pass'
</code></pre>

<p>The professor asks not to change anything above.
I'm trying to accomplish:</p>

<pre><code>count = 0
for e in s:
    count +=1
return count
</code></pre>

<p>It gives:</p>

<pre><code>(executing lines 1 to 17 of "e_count_103.py")

15
</code></pre>

<p>Using for loop:</p>

<pre><code>def eCount(s):
    count = 0
    for c in s:
        if c in ('e', 'E'):
            count += 1
    return count
</code></pre>

python loops count