Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

NO chatgpt, no AI please : Write a function named find _ indices which takes two parameters as follows: A list that may or may

NO chatgpt, no AI please : Write a function named find_indices which takes two parameters as follows:
A list that may or may not contain values (can be mixed data types), and
A target value (of any type)
The function should return the list of indices (locations) in the list, if any, where the
target is present. Make no assumptions about the data in the list, or the length of the
list. The function should work if the list is empty or not empty.
Example Executions
data =[]
print(find_indices(data,1)) # prints []
data =[1,3,5,1,3,5]
print(find_indices(data,3)) # prints [1,4]
data =[-4,65,23,12,-56, 'string', True, 4.56,23]
print(find_indices(data, True)) # prints [6]
data =[2,4,6,8,10,12]
print(find_indices(data,5)) # prints []

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions