Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.image text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

6. Explain the strengths of a dialectical approach.

Answered: 1 week ago

Question

2. Discuss the types of messages that are communicated nonverbally.

Answered: 1 week ago