Here is an example of extending the first loop, see here: http://codepad.org/cn0UFPrD
rows = [[1,2,3,4],[3,5,88,9],[4,55,-6,0],[0,34,22,1222]] t1 = [(min([row[i] for row in rows]),max([row[i] for row in rows])) for i in range(len(rows[0]))] print(t1) # Easy loop t2 = [] for i in range(len(rows[0])): innerElements = [] for row in rows: innerElements.append(row[i]) newTuple = ( min(innerElements),max(innerElements) ) t2.append(newTuple) print(t2)
You can expand the second loop in the same way.
DhruvPathak Nov 08 2018-11-11T00: 00Z
source share