Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code in python please and thank you! Write a function extract-chars ) that takes one argument, data, which is a string that is supposed to

image text in transcribedimage text in transcribed Code in python please and thank you!

Write a function extract-chars ) 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 the following 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 , ' 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 Function ArgumentReturn Value ,

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions