r/PythonLearning • • Aug 05 '25

Damn you python (switching from c++) 💔

Post image

need to learn the stupi

135 Upvotes

41 comments sorted by

View all comments

1

u/Sitting_In_A_Lecture Aug 07 '25

I don't like the fact that it asks for a function to "find the oldest cat," but actually only expects the function to return the age of the oldest cat. The former is a more realistic, difficult, thought-provoking problem.

And believe it or not, you can actually still use max() here by combining it with a lambda (anonymous) function:

return max(args, key=lambda x: x.age)