Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 1: Find the Treasure Part 1 Consider the structure below (a treasure map) 1 341 211 32 : 411 25 141 42 43 |

image text in transcribed
image text in transcribed
Exercise 1: Find the Treasure Part 1 Consider the structure below (a treasure map) 1 341 211 32 : 411 25 141 42 43 | 14 31 54 1 451 52 42 23 1 33 151 51 3135 1 21 521 33 13 23 Background Eventually we will write a program to explore the above matrix for a treasure, but first lets understand the map structure. The values in the array are clues Each cell in the matrix contains an integer between 11 and 65; for each value the ten's digit represents the row number and the unit's digit represents the column number of the cell containing the next clue For example starting in the upper left corner (atrow = 1,column = 1), use the clues to guide your search of the array, So (1.1) contains 34. Next move to (3,4), which contains 43. Move to (4,2), which contains 15, and so on. The treature in a cell whose value is the same as its coordinates The program must eventually read in the treasure map data into a 5 by 5 array, and should output the cells it visite during its search, and a message Indicating where you found the treasure # script to generate the treasure map (do not modify) treasuremap = #empty list to store row, column information treasuremap.append(134,21,32,41,25]) # first row of the map treasuremap.append( (14,42,43,14,311) # second row of the map treasuremap.append( 154,45,52,42,23]): third row of the map treasuremap.append(33,15,51,31,35]) # fourth row of the map treasuremap.append( 121,52,33, 13,23])# fifth row of the map Now for your problem Write a script to take input from user in terms of row number and column number. Return contents of treasure map at position indicated by the row and column to the user it # script to access (8,3). modity for interactive input row = 1 column 3 print(treasuremap Irow-1) column-1]) print a single element

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

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions

Question

How will you identify prospective customers? LO.1

Answered: 1 week ago