Parameters Exercises
Now that we know how to use parameters, we can use that to make our earlier functions more capable. Here's an example...
import turtle
def square(size):
for a in range(4):
turtle.forward(size)
turtle.left(90)
square(10)
turtle.forward(50)
square(20)
turtle.forward(50)
square(40)
Ex 1. Shapes with parameters
Create functions for the following shapes, but with a size parameters. The first one is done for you...
- Square
- Triangle
- Pentagon
- Hexagon
Hint: You can copy the program you have written in the previous exercise.
import turtle
def square(size):
for a in range(4):
turtle.forward(size)
turtle.left(90)
square(50)
Ex 2. Houses
Create a function that draws a house that looks like this...

Then use it to create a row of houses like this...

We've prepare the start of the program for you...
import turtle
def house(size):
turtle.forward(size)
house(50)