list_of_tuples = [(2, 4), (3, 3), (4, 2)]
def my_function(list_of_tuples):
best = list_of_tuples[0]
for r in list_of_tuples:
if r[0] * r[1] > best[0] * best[1]:
best = r
return best
I want to write the above function in one line and this is my result
return [i for i in rectangles if i[0] * i[1] > list_of_tuples[0][0] * list_of_tuples[0][1]]
The problem is that I don't know how to write that part with best = r. How can I achieve this?