"""
Exercise 3: Encapsulate this code in a function named count, and generalize it
so that it accepts the string and the letter as arguments.
"""

def count ( word, letter):
    count = 0
    for letter in word :
        if letter == 'a':
            count = count + 1

    return count

word = 'banana'
letter = 'a'
print(count(word,letter))
"""

word = 'banana'
count = 0
for letter in word:
    if letter == 'a':
        count = count + 1
print(count)
"""

a27dc8ba6d868ce5fbd79b69dc7f9783c5d36181
<mask token>

<mask token>


def count(word, letter):
    count = 0
    for letter in word:
        if letter == 'a':
            count = count + 1
    return count


<mask token>

<mask token>


def count(word, letter):
    count = 0
    for letter in word:
        if letter == 'a':
            count = count + 1
    return count


<mask token>
print(count(word, letter))
<mask token>

<mask token>


def count(word, letter):
    count = 0
    for letter in word:
        if letter == 'a':
            count = count + 1
    return count


word = 'banana'
letter = 'a'
print(count(word, letter))
<mask token>

"""
Exercise 3: Encapsulate this code in a function named count, and generalize it
so that it accepts the string and the letter as arguments.
"""

def count ( word, letter):
    count = 0
    for letter in word :
        if letter == 'a':
            count = count + 1

    return count

word = 'banana'
letter = 'a'
print(count(word,letter))
"""

word = 'banana'
count = 0
for letter in word:
    if letter == 'a':
        count = count + 1
print(count)
"""
