input: def SumOfDigits(num: int) -> int:
      """
      Takes a given number and calculates the sum of its digits.
      >>> SumOfDigits(6342)
      15
      >>> SumOfDigits(123)
      6
      """
output:     sum_digits = 0
      while num > 0:
          sum_digits += num % 10
          num //= 10
      return sum_digits