Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

app.stepsPerSecond = 5 app.reds = [ 2 5 5 , 2 2 0 , 2 0 0 , 1 5 0 , 1 2 5

app.stepsPerSecond =5
app.reds =[255,220,200,150,125,100,90,75,50,10]
app.y =0
Rect(0,0,400,400)
def drawRowOfRectangles():
x =0
# Draws a rectangle for each red value.
for red in app.reds:
Rect(x, app.y,40,25, fill=rgb(red,0,0))
x +=40
def onMousePress(mouseX, mouseY):
drawRowOfRectangles()
# Remove the last value from the app.reds list and store it in newVal.
### Fix Your Code Here ###
newVal =0
# Creates a new list with the last value.
newList =[ newVal ]
# Add all of the other red values to the newList.
### (HINT: Loop over app.reds and add each element to newList.)
### Place Your Code Here ###
# Sets app.reds equal to the new list.
app.reds = newList
# Shifts where the next rectangle will be drawn.
app.y +=25
##### Place your code above this line, code below is for testing purposes #####
# test case:
onMousePress(200,200)

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

Recommended Textbook for

Database Development For Dummies

Authors: Allen G. Taylor

1st Edition

978-0764507526

More Books

Students also viewed these Databases questions

Question

What is meant by the idea of a critical mass?

Answered: 1 week ago

Question

Discuss the goals of financial management.

Answered: 1 week ago