def count_char(string, char):\n    count = 0\n    for c in string:\n        if c == char:\n            count += 1\n    return count\n\nprint(count_char("hello world", "l"))\n\nOutput: 3
Write a function to count the occurances of a given character in a string.?