Write a function extract-chars () that takes one argument, data, which is a string that is...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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. Function Argument <21@3, %{^Y%18 Return Value [ Y , i , 2138 , < @ % ^%/] [ ZAJSNE , , 9518 , ?$# ] [ , cfpuyix , , 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 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. Function Argument <21@3, %{^Y%18 Return Value [ Y , i , 2138 , < @ % ^%/] [ ZAJSNE , , 9518 , ?$# ] [ , cfpuyix , ,
Expert Answer:
Related Book For
Posted Date:
Students also viewed these accounting questions
-
In general, ionization energy increases from left to right across a given period. Aluminum, however, has a lower ionization energy than magnesium. Explain.
-
A space traveler is moving from left to right along the curve y = x2. When she shuts off the engine, she will continue traveling along the tangent line at the point where she is at that time. At what...
-
A fly is crawling from left to right along the top of the curve y = 7 - x2 (Figure 5). A spider waits at the point (4, 0). Find the distance between the two insects when they first see each other. 7...
-
Use the information in Exercise 2-16 to prepare an August 31 balance sheet for Help Today. Hint: Compute the ownerscapital account balance as of August 31. Data from Exercise 2-16 Carmen Camry...
-
Suppose the United States and Japan have the following production possibility tables: a. Draw each country's production possibility curve. b. In what good does the United States have a comparative...
-
Mass flux from a circulating bubble (a) Use Eq. 18.5-20 to estimate the rate of absorption of CO 2 (component A) from a carbon dioxide bubble 0.5 cm in diameter rising through pure water (component...
-
Acne Medication and Gastrointestinal Injury Since 1999, Kamie Kendall had experienced ongoing abdominal pain, and she was eventually diagnosed with ulcerative colitis and irritable bowel syndrome...
-
Nicholson Roofing Materials, Inc., is considering two mutually exclusive projects, each with an initial investment of $150,000. The companys board of directors has set a maximum 4-year payback...
-
We read about Language and Authority in grammar and how some groups try to control language. Identify one such group and explain how and why they try to control language. Do you think such efforts to...
-
Annie invested $5,000 in a segregated fund in a non-registered account. At that time, the basis of each unit was worth $10. At the end of the year, the fund made an allocation of $300 to Annie's...
-
2. Clipping and Scaling are two common methods used in fuzzy rule evaluation. State the differences between these two methods and illustrate each of them with a membership function diagram. (6 marks)...
-
Can anyone in the class explain what a sale/leaseback arrangement is andwhy a managerial accountant would be interested in such an arrangement? What would be the advantages and disadvantages of this...
-
What are the recipients of the work expected to abide by, according to the copyright notice?
-
Define the accrued liabilities related to accrued commissions. write a brief intro on accured liabilities.
-
Compare and contrast long-form and short-form reports. Consider the following in your response: Explain when each report type should be used. Explain the purpose of the components that should be...
-
Write an introduction for an essay going over an 10k annual report for Amazon and using it to answer a question about their inventory method and to use its financial statements to calculate Amazon's...
-
As a resident of Texas, Jim exchanged a condominium located in California for like-kind property located in Texas. He realized a gain of $15,000 on the exchange that was properly deferred under IRC...
-
On January 1, 2018, Khalid Ltd., which follows IAS 17, entered into an eight-year lease agreement for three dryers. Annual lease payments for the equipment are $28,500 at the beginning of each lease...
-
The Laurel Creek Lawn Shop sells Fastgro Fertilizer. The annual demand for the fertilizer is 270,000 pounds. The cost to order the fertilizer from the Fastgro Company is $105 per order. The annual...
-
A concessions manager at the Tech versus A&M football game must decide whether to have the vendors sell sun visors or umbrellas. There is a 30% chance of rain, a 15% chance of overcast skies, and a...
-
Robin Dillon has recently accepted a new job in the Washington, DC, area and has been hunting for a condominium to purchase. From friends and coworkers she has compiled a list of five possible...
-
When translating Acceletrons fi nancial statements into US dollars, Redline is least likely to use an exchange rate of USD per SGD: A . 0.671. B . 0.588. C . 0.654.
-
Yus determination regarding Transaction 2 should be based on the currency of the: A . loan. B . bank. C . borrower.
-
In response to the boards fourth question, the balance sheet exposure (in C$ millions) would be closest to: A . 19. B . 148. C . 400.
Study smarter with the SolutionInn App