input: Write a python function to calculate the frequency of each character in a given string.
  assert char_freq('hello') == {'h': 1, 'e': 1, 'l': 2, 'o': 1}
  assert char_freq('test') == {'t': 2, 'e': 1, 's': 1}
  assert char_freq('frequency') == {'f': 1, 'r': 1, 'e': 2, 'q': 1, 'u': 1, 'n': 1, 'c': 1, 'y': 1}
output: def char_freq(s):
      freq = {}
      for char in s:
          if char in freq:
              freq[char] += 1
          else:
              freq[char] = 1
      return freq