Are you looking for something like this:

>>> Str = '23'
>>> Sum = 0
>>> for i in list(Str):
...     Sum = Sum + int(i)
...
>>> Sum
5


On Tue, May 7, 2013 at 11:41 AM, Umesh Tiptur <umeshreloa...@yahoo.com>wrote:

> Hi all,
>
> Thanks for the reply for the basic of basic qn:
> But still I am stuck with another problem, i.e I want to add a number
> which is 23.
> I want a digit answer in this case.
>
> Any idea how to split a number into digits to add them.
>
> With regards,
> Umesh
> _______________________________________________
> BangPypers mailing list
> BangPypers@python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>
_______________________________________________
BangPypers mailing list
BangPypers@python.org
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to