0% found this document useful (0 votes)
5 views7 pages

Python Turtle Subroutine Parameters

The document provides instructions for using Python's Turtle graphics to create shapes using subroutines. It outlines tasks for drawing squares and triangles with varying sizes, moving the turtle to different locations, and ensuring shapes do not overlap. Additionally, it includes an extension task for creating patterns using colored squares.

Uploaded by

Rob Carrigan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views7 pages

Python Turtle Subroutine Parameters

The document provides instructions for using Python's Turtle graphics to create shapes using subroutines. It outlines tasks for drawing squares and triangles with varying sizes, moving the turtle to different locations, and ensuring shapes do not overlap. Additionally, it includes an extension task for creating patterns using colored squares.

Uploaded by

Rob Carrigan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Python Turtle: Subroutine Parameters

Starter: What will this code do when executed?


import turtle
t = [Link]()
#defining square subroutine
def square():
for n in range(4):
[Link](200)
[Link](90)
#calling square subroutine
square()

Adding a parameter
We can adapt the function so that we can draw a square that is
any size.
Task: Type in the code above, into a new program.
Call the square subroutine three more times.
Each time you call the subroutine enter a different value into the
parameter.
Take a screenshot of your code and the output and paste
in the box below.
Task: Type in the code above, into a new program.
Call the triangle subroutine three more times.
Each time you call the subroutine enter a different value into the
parameter.
Take a screenshot of your code and the output and paste
in the box below.
Task: Copy the code above into a new program.
-Move the turtle to a different location on the screen.
-Call the colouredSquare subroutine.
Do this three times.
No square should overlap with any other square.
Take a screenshot of your code and the output and
paste in the box below.
Task: Copy the code above into a new program.

Call the squareCol subroutine three more times.


No square should overlap with any other square.
Take a screenshot of your code and the output and
paste in the box below.

Extension Task
Using the squareCol subroutine try to make some of these
patterns.
For each pattern take a screenshot of your code and the output
and paste into one of the boxes below.

You might also like