Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # break,sort words & sentences
- def break_words(stuff):
- return stuff.split(" ")
- def sort_words(words):
- words.sort()
- return words
- def print_first_word(words):
- word = words.pop(0)
- print word
- def print_last_word(words):
- word = words.pop(-1)
- print word
- def sort_sentence(sentence):
- words = break_words(sentence)
- return sort_words(words)
- def print_first_and_last(sentence):
- words = break_words(sentence)
- print_first_word(words)
- print_last_word(words)
- def print_first_and_last_sorted(sentence):
- words = sort_sentence(sentence)
- print_first_word(words)
- print_last_word(words)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement