Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Creates some function called FindToys that will accept two parameters an array called toys and the item that will be searched for in the list.

Creates some function called FindToys that will accept two parameters an array called toys and the item that will be searched for in the list. Call this second parameter search_item. Your function needs to return a boolean value that indicates whether the search_item was found.

As an example, if we have the following list called candy:

candy = ["snicker", "milky way", "almond joy", "skittles", "Kit Kat", "M & M"] 

and our search_item is 'almond joy', your function would return True meaning that your function found our item.

To start coding this open VS Code or IDLE. Create a function. To test your function use the following code. Place this code at that bottom of your file.

def main(): toys = ["ball", "doll", "bat", "puzzle", "legos", "Barbie", "truck"] search_item = "bat" found_item = bool #call search function found_item = FindToys(toys, search_item) print(found_item) main() 

If you print out True, then you can move just your function code only over to Codio for further testing.

Please note your code will be run by Codio using two different test cases. Make sure your code can accomodate a toys list that is smaller and/or larger than the one listed above. (HINT: use the len() function.)

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 Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions

Question

=+2 What does the market buy?

Answered: 1 week ago