5.10 Exercises

From Foundations of Python ProgrammingGNU FDL 1.3Original pagePython1 class period6 exercisesNot autograded

README.md

5.10 Exercises

Read first in the book: 5.1 Hello Little Turtles!, 5.2 Our First Turtle Program, 5.3 Instances: A Herd of Turtles, 5.4 Object Oriented Concepts, 5.5 Repetition with a For Loop, 5.6 A Few More turtle Methods and Observations, 5.7 Summary of Turtle Methods, 5.8 Incremental Programming, 5.9 Common turtle Errors.

Exercise 1

Write a program that prints We like Python's turtles! 100 times.

Open the 01 folder and edit main.py. This one is not graded, so check it yourself.

Discussion question: Turtle objects have methods and attributes. For example, a turtle has a position and when you move the turtle forward, the position changes. Think about the other methods shown in the Summary of Turtle Methods page. Which attibutes, if any, does each method relate to? Does the method change the attribute?

Exercise 2

Use for loops to make a turtle draw these regular polygons (regular means all sides the same lengths, all angles the same):

  • An equilateral triangle
  • A square
  • A hexagon (six sides)
  • An octagon (eight sides)

Open the 02 folder and edit main.py. This one is not graded, so check it yourself.

Exercise 3

Write a program to draw a shape like this:

star.png

Open the 03 folder and edit main.py. This one is not graded, so check it yourself.

Exercise 4

Write a program to draw a face of a clock that looks something like this:

tess_clock1.png

Open the 04 folder and edit main.py. This one is not graded, so check it yourself.

Exercise 5

Write a program to draw some kind of picture. Be creative and experiment with the turtle methods.

Open the 05 folder and edit main.py. This one is not graded, so check it yourself.

Exercise 6

Create a turtle and assign it to a variable. When you print its type, what do you get?

Open the 06 folder and edit main.py. This one is not graded, so check it yourself.

For teachers

5.10 Exercises

Students read Foundations of Python Programming's “Exercises” in CS Room and work through its 6 Python coding exercises.

  • Time: 1 class period

Reading first

Exercises

FolderGradingTests
01Not graded; students check it themselves0
02Not graded; students check it themselves0
03Not graded; students check it themselves0
04Not graded; students check it themselves0
05Not graded; students check it themselves0
06Not graded; students check it themselves0