Now use your house function to draw a town with dozens of houses at different sizes. You’ll probably want to modify your house function to draw at an input coordinate, then change the coordinate where each house is drawn.

What will be an ideal response?


```

def createATown ():

canvas = makeEmptyPicture(600, 400)

makeHouse(canvas, 140,50, 1,1)

makeHouse(canvas, 10,120, 2,2)

makeHouse(canvas, 300,80, 3,3)

makeHouse(canvas, 223,70, 1,1)

show(canvas)

return canvas

def makeHouse(canvas, x, y, xMult, yMult):

#walls and door

addRect(canvas, 20*xMult+x, 40*yMult+y, 60*xMult, 59*yMult)

addRect(canvas, 45*xMult+x, 80*yMult+y, 10*xMult, 19*yMult)

#roof

addLine(canvas,0+x,40*yMult+y,50*xMult+x,0+y)

addLine(canvas,50*xMult+x,0+y,100*xMult+x,40*yMult+y)

addLine(canvas,0+x,40*yMult+y,100*xMult+x,40*yMult+y)

#windows

addRect(canvas, 25*xMult+x, 60*yMult+y, 9*xMult, 19*yMult)

addLine(canvas,25*xMult+x,70*yMult+y,34*xMult+x,70*yMult+y)

addLine(canvas,30*xMult+x,60*yMult+y,30*xMult+x,79*yMult+y)

addRect(canvas, 65*xMult+x,60*yMult+y, 9*xMult, 19*yMult)

addLine(canvas,65*xMult+x,70*yMult+y,74*xMult+x,70*yMult+y)

addLine(canvas,70*xMult+x,60*yMult+y,70*xMult+x,79*yMult+y)

```



Computer Science & Information Technology

You might also like to view...

Which of the following statements are true?

a. Recursive methods run faster than non-recursive methods. b. Recursive methods usually take more memory space than non-recursive methods. c. A recursive method can always be replaced by a non-recursive method. d. In some cases, however, using recursion enables you to give a natural, straightforward, simple solution to a program that would otherwise be difficult to solve.

Computer Science & Information Technology

A banner developed with Flash can allow the user to ____.

A. enter data B. have data processed C. return a result directly from Flash Player D. all of the above

Computer Science & Information Technology

A bookmark for the ________ of the Web page is created automatically

A) end B) bottom C) top D) center

Computer Science & Information Technology

An administrator wants to establish a WiFi network using a high gain directional antenna with a narrow radiation pattern to connect two buildings separated by a very long distance. Which of the following antennas would be BEST for this situation?

A. Dipole B. Yagi C. Sector D. Omni

Computer Science & Information Technology