Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 100 pts Write a Python program that contains two functions: main function and search function. Inside the main function: (1) create a string

image text in transcribed

Question 1 100 pts Write a Python program that contains two functions: main function and search function. Inside the main function: (1) create a string variable my-string and assign .. 1aB2cA3# to it; (2) using the strip-related methods to strip off the '*' on the left end and the on the right end of my_string, update and print my_string (3) Call the proper method to capitalize the lowercase letters of my string, again update and print my_string; (4) Call search function twice to search for 'A' and 'c, respectively. The search function has two parameters: my_string and target. target is the substring to search for within my string. Find method will be used to return the index of the first occurrence of the substring, if it is found: Otherwise (target does not exit in my_string) print 'XX is not found: XX is the target substring passed in. After strip: 1aB2cA3 After capitalization: 1AB2CA3 The index of A is 1 c is not found

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

Recommended Textbook for

Database Modeling And Design

Authors: Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, H.V. Jagadish

5th Edition

0123820200, 978-0123820204

More Books

Students also viewed these Databases questions

Question

11.5 Describe the grievance procedure in a union environment.

Answered: 1 week ago

Question

Which are non projected Teaching aids in advance learning system?

Answered: 1 week ago