def longest_word(string_of_words):
return max(reversed(string_of_words.split()), key=len)
def longest_word(string_of_words):
# Give me back the longest word!
return max(reversed(string_of_words.split(' ')),key = len)
def longest_word(string_of_words):
# Give me back the longest word!
return max(reversed(string_of_words.split()),key=len)
def longest_word(string_of_words):
return max(reversed(string_of_words.split(' ')), key=len)
def longest_word(s):
return sorted(s.split(), key = len)[-1]
def longest_word(s):
return sorted(s.split(' '), key=len)[-1]
def longest_word(words):
return max(reversed(words.split()), key=len)
def longest_word(words):
return max(reversed(words.split(' ')), key=len)
def longest_word(string_of_words):
words = string_of_words.split()[::-1]
return max(words, key = len)
def longest_word(string_of_words):
# Give me back the longest word!
pass
words = string_of_words.split()[::-1]
return max(words, key = len)
longest_word = lambda s: max(s.split()[::-1],key=len)
longest_word = lambda s: max(s.split(' ')[::-1], key = len)
def longest_word(string_of_words):
return ''.join(sorted(string_of_words.split(' '), key=len)[-1])
def longest_word(str_):
return max(str_.split(' '), key=lambda x: (len(x), str_.index(x)))
from collections import defaultdict
def group_by(f, xs):
groups = defaultdict(list)
for x in xs:
groups[f(x)].append(x)
return groups
def last(xs):
return xs[-1]
def longest_word(string_of_words):
# Give me back the longest word!
words_by_len = group_by(len, string_of_words.split(' '))
return last(words_by_len[max(words_by_len.keys())])
def longest_word(text):
m = 0
s = ""
for x in text.split(" "):
if(len(x) >= m):
m = len(x)
s = x
return s
def longest_word(string_of_words):
return sorted(string_of_words.split(), key=len)[-1]
def longest_word(string_of_words):
return sorted(string_of_words.split(' '),key=len)[-1]
def longest_word(string_of_words):
return sorted(string_of_words.split(" "), key=len)[-1]
景越Python基础训练营QQ群
欢迎各位同学加群讨论,一起学习,共同成长!