input: Write a function to count the occurrences of each character in a given string and return the result as a dictionary where the keys are the characters and the values are their respective counts.
  def count_chars(string):
      count_dict = {}
  
      for char in string:
          if char in count_dict:
              count_dict[char] += 1
          else:
              count_dict[char] = 1
  
      return count_dict
  
  assert count_chars("Hello World")=={'H': 1, 'e': 1, 'l': 3, 'o': 2, ' ': 1, 'W': 1, 'r': 1, 'd': 1}
  assert count_chars("Python Programming")=={'P': 2, 'y': 1, 't': 1, 'h': 1, 'o': 2, 'n': 2, ' ': 1, 'r': 2, 'g': 2, 'a': 1, 'm': 2, 'i': 1}
  assert count_chars("Quick brown fox")=={'Q': 1, 'u': 2, 'i': 1, 'c': 1, 'k': 1, ' ': 2, 'b': 1, 'r': 2, 'o': 2, 'w': 1, 'n': 1, 'f': 1, 'x': 1}
  assert count_chars("")=={}
  assert count_chars("a"*5+"b"*3)=={'a': 5, 'b': 3}
output: def count_chars(string):
      count_dict = {}
  
      for char in string:
          if char in count_dict:
              count_dict[char] += 1
          else:
              count_dict[char] = 1
  
      return count_dict