Randomness Practice
You will show Ms. Martin at least 2 of these to get checked off. You are expected to be focused and work to the best of your abilities.
1: Flashing lights
Write a Turtle Graphics program that makes the screen flash different colors one after the other. You will want to use the bgcolor function which works just like color but changes the color of the full screen.
2: 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.
3: 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. Alternately, you could draw circles of increasing radius.
4: ASCII box
Write a function draw_box that takes in three parameters: a width, a height and a character to print. Note that you can multiply text by a number to repeat it — “*” * 10 is “**********”.
draw_box(5, 4, “#”) should output:
##### # # # # #####
draw_box(10, 6, “.”) should output:
.......... . . . . . . . . ..........
5: 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!






(4 votes, average: 3.75 out of 5)