Created
April 21, 2020 00:15
-
-
Save roman-on/8eec025a02cc77947a070f8fda37097c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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