Skip to content

Instantly share code, notes, and snippets.

@roman-on
Created April 21, 2020 00:15
Show Gist options
  • Save roman-on/8eec025a02cc77947a070f8fda37097c to your computer and use it in GitHub Desktop.
Save roman-on/8eec025a02cc77947a070f8fda37097c to your computer and use it in GitHub Desktop.
"""
The function receives a list consisting of strings and returns the longest string.
list1 = ["111", "234", "2000", "goru", "birthday", "09"]
longest(list1)
birthday
"""
def longest(my_list):
x = sorted(my_list, key=len)
print (x[-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment