Question: This is for an intro to Python Class: Write a function called find_treasure that has a 2D list as a parameter. Each item in each
This is for an intro to Python Class:
Write a function called find_treasure that has a 2D list as a parameter. Each item in each list in the 2D list is a string. Exactly one of those strings is the letter 'x'. The function should return the indexes (row and column as a tuple) where the letter 'x' can be found.
Say you have the following list:
treasure_map = [[' ', ' ', ' '], [' ', 'x', ' '], [' ', ' ', ' ']]
The letter 'x' can be found at row 1, column 1 (note that row and column both start at 0, unlike exercise 17.1). Calling your function like this should output (1, 1):
print(find_treasure(treasure_map))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
