Skip to content

Instantly share code, notes, and snippets.

@jumasheff
Last active May 12, 2018 12:54
Show Gist options
  • Select an option

  • Save jumasheff/9db93e9da2741b26b04cd19a901178bc to your computer and use it in GitHub Desktop.

Select an option

Save jumasheff/9db93e9da2741b26b04cd19a901178bc to your computer and use it in GitHub Desktop.
def second_word(text):
"""
returns the last word in a given text.
"""
some_result = ""
return some_result
if __name__ == '__main__':
print("Example:")
print(second_word("Hello world"))
assert second_word("Hello world") == "world"
assert second_word(" a word ") == "word"
assert second_word("don't touch it") == "it"
assert second_word("greetings, friends") == "friends"
assert second_word("... and so on ...") == "on"
assert second_word("hi") == "hi"
assert second_word("Hello.World") == "World"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment