Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Example 1 Example 2 Example 3 Example 4 abcabdab cab 2 sfuisauni sau 4 hhgywshxns wsx -1 yyyyyyy yyyy 0 Programming language: python This program,

Example 1

Example 2

Example 3

Example 4

abcabdab

cab

2

sfuisauni

sau

4

hhgywshxns

wsx

-1

yyyyyyy

yyyy

0

Programming language: python

This program, called SubstringFinder2, finds a target string in a source string and returns the index of the first character of target in source.SubstringFinder2 works as follows:

SubstringFinder2 takes a string called source as the first input.

Then, the program takes the string target as the second input.

SubstringFinder2 is supposed to check if target is a substring of source, and if yes, it returns the index of the first character of target where it appears in source.

If target does not appear in source, SubstringFinder2 prints -1.

In developing SubstringFinder2, you are not allowed to use any Python built-in methods or user-defined modules. Instead, you have to use the basic knowledge of string

processing such as the index operator, the slice operator, and string comparisons. You can see examples of SubstringFinder2 input and output in the table above. Note that your program input and output format should be exactly the same as the format of the examples shown in the table above.

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_2

Step: 3

blur-text-image_3

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 101

Authors: Guy Kawasaki

1st Edition

0938151525, 978-0938151524

More Books

Students also viewed these Databases questions