write a function that create a list containing a series of lists that represent positions of a square's grids. Given argument is the width or height of the square
eg : >>> square_position( height = 2 )
output : [[0,0],[0,1],[1,0],[1,1]]
Please answer it in Python 3.0 . Thanks
def square_position(side): positions = [] for row in range(side): for col in range(side): positions.append([row, col]) return positions print(square_position(3)) print(square_position(2))
Please upvote, as i have given the exact answer as
asked in question. Still in case of any issues in code, let me know
in comments. Thanks!
write a function that create a list containing a series of lists that represent positions of a square's grids. Given argument is the width or height of the square eg : >>> square_position...
Please design the function in version 3 of python 4. Write a function extract(pixels, rmin, rmax, cmin, cmax) that takes the 2-D list pixels containing pixels for an image, and that creates and returns a new 2-D list that represents the portion of the original image that is specified by the other four parameters. The extracted portion of the image should consist of the pixels that fall in the intersection of the rows of pixels that begin with row rmin...