Randomness Activities

posted by: Ms. Martin 22 March 2010 3 Comments

Activity 1: Squiggles

Write a Turtle Graphics program that draws random squiggles. Your turtle should go forward a random amount, turn a random amount and draw a line of a random color. Your program should produce output similar to the image at left.

Make sure you understand what the type and range of parameters to forward, right and color are and pick random values that fit.

Activity 2: Colorful pole

Write a Turtle Graphics program that produces a shape similar to the one at the left.  Your pen width will have to change over time and you will have to pick a random color every time you go forward.

Activity 3: Coin flip

Write a program to simulate 100 coin flips.  Your program should write out “head” randomly half the time and “tail” randomly half the time.  For extra awesomeness, report at the end of your 100 flips how many heads and tails you got.

Activity 4: Random art

Have some fun with this.  What can you come up with?

Believe it or not, the image at the left was randomly generated using a Python program.  Doing something exactly like that requires slightly more advanced material than what we’ve covered but some of you will be perfectly able to do this by the end of the semester!

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>