Challenge: Check Substring

Check if a specific string exists in a given string in this challenge.

Problem statement

In this challenge, you have to write code that checks if a string contains a specific string. Your code should return 1 if it does else return -1.

Sample input

The quick brown fox jumps over the lazy dog.

Check whether the said string contains the string jumps.

Sample output

1

Hint: Use the built-in functions you learned about in the previous lesson.

Important Note: Your code needs to pass all three test cases in order to be considered correct.

Coding challenge

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy