Answers for "get longest shortest word in list python"

1

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'
Posted by: Guest on May-01-2021

Code answers related to "get longest shortest word in list python"

Browse Popular Code Answers by Language