Revision 08b8aebf-71bb-426c-a586-e8b00ded4df0 - Stack Overflow

You can use `zip()` to zip together each list and each sublist to compare them element-wise:

 >>> def max_value(lst1, lst2):
 	for subl1, subl2 in zip(lst1, lst2):
 		for el1, el2 in zip(subl1, subl2):
 			yield max(el1, el2)
 
 			
 >>> 
 >>> a=[[2,4],[6,8]]
 >>> b=[[1,7],[5,9]]
 >>> 
 >>> list(max_value(a, b))
 [2, 7, 6, 9]

AltStyle によって変換されたページ (->オリジナル) /