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