my_str = ("Zebra Cheese Cucumber bus")

# breakdown the string into a list of words
words = my_str.split()

# sort the list
words.sort()

# display the sorted words
for word in words:
      print(word)
Вывод результата:
Cheese
Cucumber
Zebra
bus


2015-11-29 • Просмотров [ 188 ]