Deborah R. Fowler
Turtle Graphics
Posted on Aug 29 2018Updated April 15 2021
- looping - repetition of code
- functions - repetition of code and organization
(modularity)
Please note that the embedded videos will no longer play on IE or
if the pdf is downloaded.
Chrome and
Firefox do not supported embedded videos.
For your convenience the videos have been added as gifs below the
pdf.
After reviewing this section see also additional
examples
Sample code as well as the gifs from the presentation slides are
provided below
01_PPTprintHello.py
02_PPTsquare.py
03_PPTsquareLoop.py
04_PPTsquareWhileLoop.py
05_PPTsquareFunction.py
06_PPTsquareFunctionParms.py
07_PPTsquareFunctionParmsVar.py
NOTE: You are not required to work in IDLE, you may work in geany
on linux as later in the quarter you will have to be familiar with
linux.
Turtle Square
Turtle Loop
Turtle Nested Loop and IDE File
HOMEWORK:
- On the weekend work on your snowman. Try creating a better snowman. If you want to push it further:
- Make it a function
- Make it sizeable
- You may start Exercise 1 but it is not expected
Dropbox.com is where you will hand in your files. For Dailies
exercises they will be contained in a Dailies folder you create
and will follow the naming convention of FirstnameTopic. So for
your snowman:
Please place your python file into dropbox.com in your Dailies folder where you put your FirstnameInitials.py
Inside Dailies create a folder and name it FirstnameSnowman. In that folder will be:
- FirstnameSnowman.py
- FirstnameSnowman.jpg (or png) which is simply a screen snap of your snowman
Dailies exercises are working toward gaining the skills needed for the more formal exercises, 1-4 and those will follow the submission guidelines as specified on the exercise handout.
If you get stuck, you might want this video on a simple snowman useful (vimeo link below, also on youtube):
Hints:
Additional example files
- draw a triangle or any polygon example by specifying vertices
- draw a triangle using a loop
- create a function with a re-sizeable triangle
- example using loops, function and setting the window size
- using color and begin_fill with end_fill
- example of using an if statement and a function to draw snowman arms
- example of a smile function
- draw an oval
- square
centered