title: How to get digit sum in python
body: <p>Let say I have </p>
  
  <pre><code>num = 123456
  </code></pre>
  
  <p>How do I get the digit sum which is 21? How to use the sum() function? I tried sum(num) but it says 'int' object is not iterable.</p>