Question: Write a function get_quotes (text) that takes in a string of English text, and extracts a list of all of the quotations from the

Write a function get_quotes (text) that takes in a string of English text, and extracts a list of all of the quotations from the string. Here a quotation is defined as the sequence of characters that occur between the first quotation mark (") in the text and the second, and those that occur between the third quotation mark and the fourth, and so on. You can assume that there will be an even number of quotation marks in the string, and that there will be no apostrophe/single quote marks (') within the string (mostly because they will be used to start/end the string itself). Hint: While this can be done using .find or regular expressions, there's a very simple solution that uses.split and slicing. Examples: >>> get_quotes ('I began. "Here is a quote", I said. She nodded; "This is also a quote", she replied.') ['Here is a quote', 'This is also a quote'] >>> get_quotes('Again he said:-"Welcome to my house. Come freely. Go safely; and leave something of the happiness you bring!" The strength of the handshake was so much akin to that which I had noticed in the driver, whose face I had not seen, that for a moment I doubted if it were not the same person to whom I was speaking; so to make sure, I said interrogatively:-"Count Dracula?" He bowed in a courtly way as he replied: "I am Dracula; and I bid you welcome, Mr. Harker, to my house."') ['Welcome to my ho se. Come freely. Go safely; and leave something the happiness you bring!', 'Count Dracula?', 'I am Dracula; and I bid you welcome, Mr. Harker, to my house.'] >>> get_quotes ('"The man who wrote it was presumably well to do, I remarked, endeavouring to imitate my companion's processes. "Such paper could not be bought under half a crown a packet. It is peculiarly strong and stiff." "Peculiar-that is the very word," said Holmes. "It is not an English paper at all. Hold it up to the light." I did so.') 11
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
