Question: # This function will search the given text in order to find a given word def is_word_there(text, word): What it takes? a text to
# This function will search the given text in order to find a given word def is_word_there(text, word): """ What it takes? a text to be searched a word to be searched within a text what it does? searches if a word occurs in a text What it returns? returns 1 if word is in the text. returns -1 if word is not in the text """ # your code goes in here return Test Case for Question 1..................................
score = dict() text = """ Python is an amazing programming language. Python is also one of the primary languages in the data analysis field""" word = "amazing" try: if is_word_there("amazing") ==1: score['question 1'] = 'pass' else: score['question 1'] = 'fail' except: score['question 1'] = 'fail' is_word_there(text, word)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
