input: Write a function to calculate the sum of the digits of a given number. If the given number is empty then return 0.
  def sum_of_digits(num):
      if not num:
          return 0
      total = 0
      for ch in str(num):
          total += int(ch)
      return total
  
  assert sum_of_digits(6342)==15
  assert sum_of_digits(345)==12
  assert sum_of_digits(9876)==30
  assert sum_of_digits(0)==0
  assert sum_of_digits("")==0
output: def sum_of_digits(num):
      if not num:
          return 0
      total = 0
      for ch in str(num):
          total += int(ch)
      return total