Then Isaac's function does that(but you have to leave a space after last number in the string).
def foo(x): a, b = 0, "" for i in x: if i != " ": b += i else: print ("this is b", b) a += int(b) print ("this is a",a) b = "" print ("final a ",a) foo("10 5 8 ") regards, Sarma. On Wed, Oct 12, 2016 at 11:35 PM, Alan Gauld via Tutor <tutor@python.org> wrote: > On 12/10/16 17:58, D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote: >> Sorry, I did not read the conditions that split and for should not be used. > > It is even more confusing - split() may NOT be used > but 'for' MUST be used... > > -- > Alan G > Author of the Learn to Program web site > http://www.alan-g.me.uk/ > http://www.amazon.com/author/alan_gauld > Follow my photo-blog on Flickr at: > http://www.flickr.com/photos/alangauldphotos > > > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor