Question: PYTHON 3 HELP. I want to randomly draw horizontal and vertical rectangles that are (5X36 pixels) over my 10x10 grid . each square is 40

PYTHON 3 HELP.

I want to randomly draw horizontal and vertical rectangles that are (5X36 pixels) over my 10x10 grid . each square is 40 pixels

the grid that I have generated so far is as follows:

def thefield(): #graphics window with a white background and the coordinates flipped field = GraphWin("Field", 400,400) field.setBackground("white") field.setCoords(0,0,10,10) #setting up the grid on the page #grid will be 10x10 for i in range(10): Line(Point(0,i),Point(10,i)).draw(field).setFill("light grey") for x in range(10): Line(Point(x,0),Point(x,10)).draw(field).setFill("light grey")

how do i randomly generate these rectangles over my entire grid? Thanks

I also need to store these to a list. I've added to images to explain better what I'm trying to do but can't figure out.PYTHON 3 HELP. I want to randomly draw horizontal and vertical rectanglesthat are (5X36 pixels) over my 10x10 grid . each square is

in the project description. Write a separate function that completes the following tasks: Loop through each column and randomly decide whether to draw a 36x5 horizontal orange Rectangle Loop through each row and randomly decide whether to draw a 5x36 vertical orange Rectangle Define a List including the border locations where an orange sensor Rectangle was drawn Return the List of sensor locations 1. 2. 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!