Question: python 2. (8 points) Write a program that imitates the str.find() function. Your program should ask the user for the original string at the beginning.

python python 2. (8 points) Write a program that imitates the str.find() function.

2. (8 points) Write a program that imitates the str.find() function. Your program should ask the user for the original string at the beginning. After that it will repeatedly ask the user for the character to search for, the starting index (if empty default to 0), the ending index (if empty default to the length of the original string). Each time the program must print the index of the first occurrence of the character. The program should stop if the character is not provided (i.e., the user presses enter without writing anything). Below is a sample run of the program. Enter a string: The quick brown fox is in the empty house. Enter a character to search for: f Enter the start index: Enter the end index: Character f appears first at index 16 Enter a character to search for: f Enter the start index: Enter the end index: 15 Character f is not in the string Enter a character to search for: 2 Enter the start index: Enter the end index: Character z is not in the string Enter a character to search for: h Enter the start index: 10 Enter the end index: 30 Character h appears first at index 27 Enter a character to search for: Process finished with oxit code 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!