) Write a Python program to display a string's index 0, 1, 2, 6, 7, 8,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
) Write a Python program to display a string's index 0, 1, 2, 6, 7, 8, 12, 13, 14, 18, 19, 20, ... (3 on and 3 off pattern) location characters for any string given. "abcdefghijklmnopqrstuvwxyz" Sample Input String: Sample Output: abcghimnostuyz 2. (30pts) Write a Python program to find out all index locations that has a certain pattern a string. (return a list, return [] if no such pattern in the string.) Sample String: "abaaababbbbaaabbabababababbbaaaaabababababbbbb" Pattern: "abb" Sample Output: [6, 13, 24, 40] ) Write a Python program to display a string's index 0, 1, 2, 6, 7, 8, 12, 13, 14, 18, 19, 20, ... (3 on and 3 off pattern) location characters for any string given. "abcdefghijklmnopqrstuvwxyz" Sample Input String: Sample Output: abcghimnostuyz 2. (30pts) Write a Python program to find out all index locations that has a certain pattern a string. (return a list, return [] if no such pattern in the string.) Sample String: "abaaababbbbaaabbabababababbbaaaaabababababbbbb" Pattern: "abb" Sample Output: [6, 13, 24, 40]
Expert Answer:
Answer rating: 100% (QA)
Here are two Python programs for your requested tasks Task 1 Display Characters at Specific Index Lo... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
What is the differences between Autocratic Leadership and Democratic Leadership? Which leadership model do you believe is more effective? Why?
-
A researcher wanted to find out if there was difference between older movie goers and younger movie goers with respect to their estimates of a successful actors income. The researcher first...
-
Reviewing your corporation's statement of cash flows: what do you learn about your SEC 10-K company as you view the four financial statements together? Use course resources to explain the purpose of...
-
Tom Jones, the mechanic at Golden Muffler Shop, is able to install new mufflers at an average rate of 4 per hour (or about 1 every 15 minute), according to a negative exponential distribution....
-
Write a general set of facts and axioms to represent the assertion Wellington heard about Napoleons death and to correctly answer the question Did Napoleon hear about Wellingtons death?
-
Total gross sales for the period include the following: Credit card sales (discount 3%) ....................... $ 9,400 Sales on account (2/15, n/60) .......................... $ 12,000 Sales returns...
-
a. Describe how an express warranty is created. b. Describe how an implied warranty of merchantability is created. c. Describe how an implied warrant of fitness for a particular purpose is created.
-
A survey asks respondents to respond to the statement My work is interesting. Interpret the frequency distribution shown here (taken from an SPSS output): My work isinteresting: Category Abs. Freq...
-
"Managing Away Bad Habits Team Assignment Organizational Behavior IILeadership Assigned is ashort case from the exercise Managing Away Bad Habits. The task is to develop a turnaround strategy for...
-
Formulate a linear program which can be used to generate a comprehensive plan for the whole Far Eastern operations. Clearly define every variable used in your formulation. Start your report with an...
-
CNH Capital (NLD) (a subsidiary of CNH Global) and Ivanhoe Mines Ltd. (CAN) sign a lease agreement dated January 1, 2015, that calls for CNH to lease a front-end loader to Ivanhoe beginning January...
-
Discuss any one of the consistency theories and explore its application to business practice.
-
Identify the part played by culture and ethics in decision making.
-
Discuss the significance of knowledge management for an organization exposed to highly competitive market conditions.
-
Examine the role of the external environment as a contingency factor.
-
Outline the different phases of skills development in cognitive learning, and comment on the part played by feedback.
-
a) Calculate the reduction potential for 0.01 M NaNO3 at 25 C. Discuss the reasons why this value differs from the standard reduction potential. b) Explain what a salt bridge does in an...
-
For a nonzero constant a, find the intercepts of the graph of (x 2 + y 2 ) 2 = a 2 (x 2 - y 2 ). Then test for symmetry with respect to the x-axis, the y-axis, and the origin.
-
Phil and Linda are 25-year-old newlyweds and file a joint tax return. Linda is covered by a retirement plan at work, but Phil is not. a. Assuming Phil's wages were $27,000 and Linda's wages were...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
Ken (age 31) and Amy (age 28) Booth have brought you the following information regarding their income, expenses, and withholding for the year. They are unsure which of these items must be used to...
-
Prove that the dual function of Eq. (16.12) is concave Data From Equation (16.12) 19S See https://www.gams.com/ 20 See http://cvxr.com/
-
Consider the problem min x1+x2 s.t. h(x) = x2 x3 = 0, - - h2(x) = x2 = 0,
-
Consider the discrete optimization problem The feasible set consists of a finite collection of m points in Rn, and we have one inequality constraint. Dualize the inequality and show that the dual...
Study smarter with the SolutionInn App