Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

# Below is the bugged version of find_element(). Find and fix the bug! def find_element(word, word_list): idx_list = [] for idx in range(len(word_list)): if word

image text in transcribed

# Below is the bugged version of find_element(). Find and fix the bug!

def find_element(word, word_list): idx_list = [] for idx in range(len(word_list)): if word in word_list[idx]: idx_list.append(idx) return idx_list

Practice using test cases to debug a function. This is the same function we developed earlier in the iterative development lesson. It is a function that takes as arguments a string and a list of strings, and returns the a list of indices where the first string was found in the list. It is to be case insensitive and handle partial words as well. Check back in 5.2 for more complete definition. Find the error in this version of that code and fix it. Hint: is some functionality missing? Sample Input 1: cot ['cot', 'COT', 'CAT', 'cinch'] Sample Output 1: [0, 1] Sample Input 2: a ['apple', 'banana', 'orange', 'cherry'] Sample Output 2: [0, 1, 2]

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

Step: 3

blur-text-image

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

Pro Oracle Fusion Applications Installation And Administration

Authors: Tushar Thakker

1st Edition

1484209834, 9781484209837

More Books

Students also viewed these Databases questions

Question

What are the need and importance of training ?

Answered: 1 week ago

Question

What is job rotation ?

Answered: 1 week ago