Develop a program in Python for counting the occurrences of a given character in a string.
String: abcdefg
Character: a
def countOccurences(str, char):
    count = 0
    for ch in str:
        if ch == char:
            count += 1
    return count

print(countOccurences('abcdefg', 'a'))