Write a Python program that does the following.
my_string = "cat dog sheep goat tiger lion goose duck bird anything whatever test string"
my_string_list = my_string.split()
my_string_list.pop()
my_string_list.remove("whatever")
del my_string_list[0]
my_string_list.sort()
my_string_list.append("cat")
my_string_list.extend(["string"])
my_string_list.insert(0, "whatever")
my_string = " ".join(my_string_list)
print(my_string)
Comments
Leave a comment