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
![Python 3.6.1 (default, Dec 2015, 13:05:11) [GCC 4.8.2] on Linux [[6, θ], [6,-1],tte, 2], [1, e). [1, 1], [1, 2] positions[ fo](http://img.homeworklib.com/images/dfb2ab25-6be2-4b61-a5bc-d23dc0216ddf.png?x-oss-process=image/resize,w_560)
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...
Python Write a function square(a) that takes a list a of numbers and squares each of the numbers in the list. The function should not return a value (more specifically, it should return None). Write a function squared(a) that takes a list a of numbers and returns a new list that contains each value in a squared. The original list a should not be modified by your function. Write a function lowercase(a) that takes a list a of strings and...
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...