Question: PLEASE REFER TO THIS LINK: https://www.cs.uic.edu/bin/view/CS111/Lab4s17 USING PYTHON, I AM TRYING TO MAKE 8 SQUARES GETTING LARGER AND LARGER ON TOP OF EACH OTHER. THIS
PLEASE REFER TO THIS LINK: https://www.cs.uic.edu/bin/view/CS111/Lab4s17
USING PYTHON, I AM TRYING TO MAKE 8 SQUARES GETTING LARGER AND LARGER ON TOP OF EACH OTHER. THIS IS THE WORK THAT I HAVE SO FAR. I AM VERY CLOSE I JUST NEED TO UNDERSTAND HOW TO ADJUST LENGTHS OF THE SIDES OF THE SQUARE EACH TIME TO MAKE SURE THAT THEY ARE GETTING LARGER AND LARGER
def main(): w=makeWorld() t1=makeTurtle(w) t1.setPenColor(red) t1.setPenWidth(1) currentColor=makeColor(0,0,255) drawSquare(t1,50) count=1 length=50 while ( count <= 8 ) : reposition ( t1, 8+count,count ) lengthValue=100-(count*10) drawSquare ( t1, lengthValue ) count = count + 1 def reposition ( t1, deltaX, deltaY ) : deltaX=10 deltaY=10 xpos = getXPos ( t1 ) ypos = getYPos ( t1 ) xpos = xpos+ deltaX ypos = ypos+ deltaY penUp ( t1) moveTo ( t1 , xpos, ypos ) penDown ( t1 )
def drawSquare(t1, lengthValue): count=1 lengthValue=count*80 while(count<=4): forward(t1,lengthValue) turn(t1,90) count=count+1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
