input: Write a function to calculate the sum of the digits in a given number. If the given number is negative, the function should return 0. The function should return the sum of all digits in the number.
  def sum_digits(num):
      if num < 0:
          return 0
      total = 0
      while num > 0:
          digit = num % 10
          total += digit
          num = num // 10
      return total
  
  assert sum_digits(123) == 6
  assert sum_digits(456789) == 39
  assert sum_digits(-123) == 0
  assert sum_digits(0) == 0
  assert sum_digits(999) == 27
output: def sum_digits(num):
      if num < 0:
          return 0
      total = 0
      while num > 0:
          digit = num % 10
          total += digit
          num = num // 10
      return total