Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

##Please assist me in the following problem. ##I'm not sure what other conditional statements need to be placed sown in order to be able to

##Please assist me in the following problem.

##I'm not sure what other conditional statements need to be placed sown in order to be able to pass cases (3, 3, 5), (5, 5, 7), (5, 5, 8), and (5, 5, 9)

image text in transcribed

def getEdge(width, height, tile1):

width = w

height = h

tile1 = tile1

row = (tile1 - 1) // width

column = (tile1 -1) % width

if (row == 0) or (row == h - 1) or (row == 1):

return True

if (column == 0) or (column == w - 1):

return True

##I'm sure another conditional statement needs to be placed here, but I've been staring at this too long.

else:

return False

#END MY ATTEMPTED CODE

failed = False

ctr = 0

while ctr + 1

pieces = contents[ctr].split(" ")

if pieces[0] == "getEdge":

result = getEdge(int(pieces[1]), int(pieces[2]), int(pieces[3]))

expected = contents[ctr+1].rstrip()

if (expected == str(result)):

print "passed test"

else:

print "For input " + contents[ctr] + ", we expected '" + expected + "', but you got '" + str(result) + "'"

failed = True

ctr = ctr + 2

if not failed:

print "You passed all tests! Great work!

result = subprocess.check_output

else:

print "At least one test case did not pass yet."

result = subprocess.check_output

Tmagine that the user specities the width and height of a grid, as well as a tile. You willether True" or "False" depending on whether or not the tile is along the edge of grid. For example, on a 7x8 grid, assuming the tile uumbers (starting at the top-left comer) are 1, 2, 356 15 29 43 50 all yellow tiles are on the edge. You may use the following formulas in your alorithm as needed: row (tile - 1) / width col (tile - 1) % width

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

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions