COSC 235

Programming & Problem Solving


Project 3


Due September 29th (Friday) by 11:59PM

Overview

This project will get you acquainted with the Turtle graphics library in Python, and give you experience with functions and parameters.

To Do

Write a Python program (call it 'flowers.py') by first typing the code from Figure 3.6 in your textbook into the file, then changing it to accomplish the following:

  1. Modify the flower function so that it allows different number of petals. The revised function will need to take an additional parameter: flower(tortoise, fcolor, length, petals). Note that the original function has the turtle travel a total of 8*135=1080 degrees. When you generalize the number of petals, make sure that the total number of degrees is still a multiple of 360.
  2. After making that change, each click should draw a flower with a randomly chosen bloom color and a randomly selected number of petals chosen from 5, 7, 10, or 20.
  3. Add some new color choices as well for both the bloom and the stem.
  4. Make sure to document your program by adding an author and date at the top, and adding comments throughout the code.

Submit

To submit, save your Python program in a file named 'flowers.py', and submit it to Moodle by the due date.