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.
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. 4Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started