words = 'Create a string that is a long series of words separated by spaces can be names, favorite foods, animals, anything'
#Turn the string into a list of words using split.
words = words.split()
#Delete 3 words
words.remove('Create')
words.pop(-1)
del words[1]
#Sort elements
words.sort()
#Add elements
words.append('first')
words.insert(4,'second')
words.extend(['third', 'forth'])
#List to string
final_sentence = ' '.join(words)
print(final_sentence)
Comments
Leave a comment