58.1k views
1 vote
Write a Python program that does the following. Create a string that is a long series of words separated by spaces. The string is your own creative choice. It can be names, favorite foods, animals, anything. Just make it up yourself. Do not copy the string from another source. Turn the string into a list of words using split. Delete three words from the list, but delete each one using a different kind of Python operation. Sort the list. Add new words to the list (three or more) using three different kinds of Python operation. Turn the list of words back into a single string using join. Print the string.

1 Answer

2 votes

Answer:

The code is attached.

Step-by-step explanation:

I created a string s including 6 colors with spaces in between. Then I converted the string into a list x by using split() method. I used three different methods for removing elements from the list. These methods are remove(), pop() and del.


\\ Then I used methods append(), insert() and extend() for adding elements to the list.


\\ Finally I converted list into a string using join() and adding space in between the elements of the list.

Write a Python program that does the following. Create a string that is a long series-example-1
User Reker
by
6.4k points