Not stuck on the problem, I’d just like some clarification of how freeCodeCamp’s method for solving this problem works.
I was able to solve the problem using
x_max = max([x for x,_ in rounded_coords])
y_max = max([y for _,y in rounded_coords])
but I’d love to understand how the lambda functions that appear as the formal solutions in the following step work.
x_max = max(rounded_coords, key=lambda i: i[0])[0]
y_max = max(rounded_coords, key=lambda j: j[1])[1]
Challenge Information:
Learn Encapsulation by Building a Projectile Trajectory Calculator - Step 16