python longest word in string
def find_longest_word(word_list):
longest_word = max(word_list, key=len)
return longest_word
python longest word in string
def find_longest_word(word_list):
longest_word = max(word_list, key=len)
return longest_word
how to get the largest word from a sentence in python
# Longest word
# Reading sentence from user
sentence = input("Enter sentence: ")
# Finding longest word
longest = max(sentence.split(), key=len)
# Displaying longest word
print("Longest word is: ", longest)
print("And its length is: ", len(longest))
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