Write a function extract .chars U that takes one argument, data, which is a string that is
Question:
Write a function extract .chars U that takes one argument, data, which is a string that is supposed to contain only uppercase letters, lowercase letters, digits and the punctuation marks given in thefollowing string:
The function reads the characters of the string from left-to-right, separating the uppercase letters, lowercase letters, digits and punctuation marks into four different result strings. The characters from the input string are appended to the four result strings in the same order they are read from the input. For example, if A' appears to the left of' B' in data, then' A' will appear to the left of ' B' in the result string of uppercase letters. In the end, the function puts these four strings into a single list, and returns the list.
Note: The order of the strings in the final list always matches this order:
[string of uppercase letters, string of lowercase letters, string of digits, string of punctuation marks]
If the function that encounters a character that's neither an uppercase letter, nor a lowercase letter, nor a digit, nor a punctuation mark from the list given above, your function ignores that character and proceeds through the remainder of the string.
The quotation marks displayed in the example return values are there to emphasize that the return values are string. Do not add quotation marks to the return values.
Microeconomics
ISBN: 9781464146978
1st edition
Authors: Austan Goolsbee, Steven Levitt, Chad Syverson