Question: Write a function find_word(sentence, word) that takes 'sentence' and 'word' as parameters and returns the index of the first occurrence of 'word' in 'sentence'. You

Write a functionfind_word(sentence, word)that takes 'sentence' and 'word' as parameters and returns the index of the first occurrence of 'word' in 'sentence'. You may assume the string has at least one character in it, and that 'word' exists in 'sentence'.

For example:

test

print(find_word('stubby tubby chubby gubby', 'tubby')) print(find_word('1213141516171819', '1')) 

result

1 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 Programming Questions!