## How to Sum the Digits of a Number in Python?

Problem Formulation Given an integer number. How to sum over all digits of this number to compute the crossfoot (cross total)? Consider the following examples: 12 –> 1+2 = 3 123 –> 1+2+3 = 3 244 –> 2+4+4 = 10 981223 –> 9+8+1+2+2+3 = 25 Method 1: sum() with Generator Expression The Python built-in sum(iterable) …