Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make two helper functions called empty() and find(). The empty() function will take in a 2D list and will return True if all values in

Make two helper functions called empty() and find(). The empty() function will take in a 2D list and will return True if all values in the 2D list are 0 and False otherwise. The find() function will take in a 2D list and a value to search for. If the value is found within the 2D list, return a list of length 2 containing the x and y indices of the position of said value. Otherwise, return [-1, -1]image text in transcribed

1. Make two helper functions called empty) and find(). The empty() function will take in a 2D list and will return True if all values in the 2D list are 0 and False otherwise. The find() function will take in a 2D list and a value to search for. If the value is found within the 2D list, return a list of length 2 containing the x and y Indices of the position of said value. Othwise, return (-1, -1] [25 marks] Sample input: grid - [C23, 34, 67). [44, 5, 31. t7, 8, 9)) Sample output: empty (grid) -> False find(grid, 67)-> (0, 2) Sample input: grid - to, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0] Sample output: empty (grid) -> True find(grid, 69) -> (-1,-1]

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

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions