Exercises: constant change

posted by: Ms. Martin 23 February 2010 3 Comments

Make sure you have read and understood the notes on for loops before starting these!

You will turn in 1 of these.

Activity 1: Square spiral

Your spiral function should have the following parameters:

  • number of repetitions (“size”)
  • spacing between repetitions (“tightness”)
  • x position of the center
  • y position of the center

Activity 2: Round spiral

Same as activity 1, but rounded!

Activity 3: Growing stars

Activity 4: Trees

Write a function draw_tree that takes a size parameter and prints out the following pattern:

Size 3:

Size 4:

Activity 4: Even numbers

Write a function that takes a parameter representing how many numbers to print.  Your function should print that number of even numbers.

Activity 5: Target

Write a target function that draws concentric circles.  It should take four parameters: a change in radius, a circle count, a pen width and a pen color.  For example, the target on the right was drawn by the call target(5, 10, 3, "purple") and the one on the left with the call target(20, 5, 2, "green").

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>