Let me use a different input args and display them below. Basically, I am hoping to add up all elements of each nested list. So at first it should start with [1,11,111] ==> 1+11+111 = 123. But instead, it appears to take the 1st element from each nested list to add up [1,2,3] = 6. How should it be corrected? Thx.
>>> alist = [[1,11,111], [2,22,222], [3,33,333]] >>> list(map(add_all_elements,*alist)) My args = (1, 2, 3) <class 'int'> i = 1 BEFORE total = 0 AFTER total = 1 <class 'int'> i = 2 BEFORE total = 1 AFTER total = 3 <class 'int'> i = 3 BEFORE total = 3 AFTER total = 6 FINAL total = 6 My args = (11, 22, 33) <class 'int'> i = 11 BEFORE total = 0 AFTER total = 11 <class 'int'> i = 22 BEFORE total = 11 AFTER total = 33 <class 'int'> i = 33 BEFORE total = 33 AFTER total = 66 FINAL total = 66 My args = (111, 222, 333) <class 'int'> i = 111 BEFORE total = 0 AFTER total = 111 <class 'int'> i = 222 BEFORE total = 111 AFTER total = 333 <class 'int'> i = 333 BEFORE total = 333 AFTER total = 666 FINAL total = 666 [6, 66, 666] -- https://mail.python.org/mailman/listinfo/python-list