Question: Using Python, Imagine that the user specifies the width of a grid, as well as a tile. You will return either True or False depending
Using Python, Imagine that the user specifies the width of a grid, as well as a tile. You will return either "True" or "False" depending on whether or not the tile is along the edge of grid. For example, on a 7x8 grid,
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | ||||||
| 15 | ||||||
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | |||||
| 36 | ||||||
| 43 | ||||||
| 50 |
all yellow tiles are on the edge. You may use the following formulas in your solution as needed: row = (tile - 1) // width col = (tile - 1) % width
template:
def getEdge(width, height, tile1): width = width height = height tile1 = tile1 #YOUR CODE GOES HERE (indented) return "fixme" #END YOUR CODE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
