Drawing Houses¶
Practice writing and calling functions that take parameters by making the turtle draw a row of houses.
Move the turtle to the left side of the window near the bottom.
Draw ONE flat-topped house with height=100 and green grass after it.
Put the code that drew the house into a function called draw_house HINT: Only the code that draws one house should go in this function.
Using the function you just created, draw 10 houses. HINT: Use a for loop.
Run the code to make sure it works before proceeding.
Now change the draw_house function to take height as a parameter.
Use random numbers to draw 9 houses of different heights.
Run the code to make sure it works before proceeding.
Make the draw_house function’s height input a string and set the height of the house based on the following: “small” = 60 “medium” = 120 “large” = 250
Make two new functions that draw different shaped roofs (JUST the roof part): draw_pointy_roof, draw_flat_roof
By calling the correct “roof” function, make large houses have flat roofs and all the others have pointy roofs.
Here is how to get random numbers: