Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
quest grind solution in Uncategorized category for The Longest Word by Bifftastic
def longest_word(sentence: str) -> str:
sentence = sentence.split()
return max(sentence, key=len, default="")
print("Example:")
print(longest_word("hello world"))
# These "asserts" are used for self-checking
assert longest_word("hello world") == "hello"
assert longest_word("openai gpt-4") == "openai"
assert longest_word("this is a sentence") == "sentence"
assert longest_word("the quick brown fox") == "quick"
assert longest_word("jumped over the lazy dog") == "jumped"
assert longest_word("typescript is great") == "typescript"
assert longest_word("the answer is 42") == "answer"
assert longest_word("to be or not to be") == "not"
assert longest_word("that is the question") == "question"
assert longest_word("") == ""
print("The mission is done! Click 'Check Solution' to earn rewards!")
Oct. 2, 2023
Comments: