Question: Please use python to code this Question 2 of 2 - Strings [4 points] Write your own version of the built-in find() function for strings.
Please use python to code this
Question 2 of 2 - Strings [4 points] Write your own version of the built-in find() function for strings. Specifically, your function should accept two parameters: a string word and a string sub. If sub can be found anywhere within word, your function should return its index location. Otherwise, find() should return -1. Your function should be sensitive to case. Here are some test cases and corresponding output that a correct solution should return: print(find("finland", 3 "land")) , print(find("Sudan", "X")) 1 > print(find("australia", "a")) >> print(find("peru", "Peru"')) >> print(find ("norway", "norway")) , print (find("laos", ""))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
