Activities: Constant change

posted by: Ms. Martin 16 February 2011 No Comment

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

I expect you to be focused and challenging yourself throughout the period.  You only need to complete one for credit that I will check off but I expect you to attempt as many as you can.

Activity 1: Growing stars


Activity 2: 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 3: Round spiral

Same as activity 1, but rounded!

Activity 4: Trees

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

Size 3:
   *
  ***
 *****
   *

Size 4:
    *
   ***
  *****
 *******
    *

Activity 5: 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 6: 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 (5 votes, average: 3.00 out of 5)
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>