Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started