Python 3 Code to Find the Longest Word or String inside List

main.py

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

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.