python longest list in list

a_list = ["a_string", "the_longest_string", "string"]
longest_string = max(a_list, key=len)
print(longest_string)

Here is what the above code is Doing:
1. We create a list of strings.
2. We call the max function, passing in the list and a key function.
3. The key function is a function that takes a single argument and returns the “key” for that argument.
4. In this case, the key function is the built-in len function, which returns the length of a string.
5. The max function returns the string with the longest length.