id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

find


Write a function that takes as parameters a two-dimensional grid (list of lists) and a value to search for, and finds the (row, column) where the value first appears, if it appears anywhere in the grid, and (−1,−1) otherwise. Once you have the tuple you want to return, you should return it as a string in the form "row column" (with no space after the column). If the target is not there you return "-1 -1"


find([[1, 2, 3, 4], [0, 5, 2, 1], [3, 3, 2, 0], [0, 0, 4, 8]], 0) → '1 0'
find([[-1, 6, 3, -4], [0, 0, 0, 0], [13, -3, 22, 10], [4, 9, -4, 5]], 22) → '2 2'
find([[1, 2, 3, 4], [0, 5, 2, 1], [3, 3, 2, 0], [0, 0, 4, 8]], -5) → '-1 -1'

...Save, Compile, Run (ctrl-enter)

def find(grid, target):

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Python Help

Copyright Nick Parlante 2017 - privacy