Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

More Books

Students also viewed these Databases questions