how to find the longest string in a list in python
a_list = ["a_string", "the_longest_string", "string"]
longest_string = max(a_list, key=len)
print(longest_string)
how to find the longest string in a list in python
a_list = ["a_string", "the_longest_string", "string"]
longest_string = max(a_list, key=len)
print(longest_string)
get longest shortest word in list python
words = ["alpha","omega","up","down","over","under","purple","red","blue","green"]
#GET LONGEST WORD
max(words, key=len)
>>> 'purple'
#GET SHORTEST WORD
min(words, key=len)
>>> 'up'
python longest word in string
def find_longest_word(word_list):
longest_word = max(word_list, key=len)
return longest_word
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us