you logic to get the longest is correct. To clean up the code a bit, read up on the inbuilt python max function.