[BangPypers] Another qn. THanks for the basic of basic qn\

L Radhakrishna Rao satishsagar83 at gmail.com
Tue May 7 08:17:59 CEST 2013


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 <umeshreloaded at 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 at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>


More information about the BangPypers mailing list