Peter Otten wrote: > Thomas 'PointedEars' Lahn wrote: >> […] But float() is always necessary for computing the sum and suffices >> indeed together with s.split() if s is just a comma-separated list of >> numeric strings with optional whitespace leading and trailing the comma: >> >> print(sum(map(lambda x: float(x), s.split(','))) >> >> Please trim your quotes to the relevant minimum. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > Hm, can you explain what this > > lambda x: float(x) > > is supposed to achieve? I mean other than to confuse a newbie...
print(sum(map(float, s.split(',')))) suffices in this case, of course. I could have done without the snide remarks. -- PointedEars Twitter: @PointedEars2 Please do not cc me. / Bitte keine Kopien per E-Mail. -- https://mail.python.org/mailman/listinfo/python-list