I have been trying to add the individual digits of a larger number for a while now, and I\'m having some trouble. I was wondering if anyone could help me.
For example, s
Treat it as a string, and sum the individual numbers. Slice if you need to.
sum
sum(map(int,str(12345))) Out[183]: 15 sum(map(int,str(12345)[1:3])) Out[184]: 5