input: from typing import List
  
  
  def sum_of_digits(num: int) -> int:
      """ Calculate the sum of the digits of a given number.
      >>> sum_of_digits(6342)
      15
      >>> sum_of_digits(123)
      6
      """
  
output:     total = 0
      while num > 0:
          total += num % 10
          num //= 10
      return total