2.3 - Activity 1
2.3 - Activity 1
Fall 2023
GCIS-123
Class Activity & Problem Solving #01
Turtle Scenery
Rubrics
15%: Problem-solving.
25%: Design:
– Implements functions for drawing the scene elements with parameters
– Properly passes arguments for drawing table, cake, and candle functions.
– Asks parameters to the user to customize the drawings.
50%: Functionality:
– 35%: Draws a scene with at least 1 candle, 1 table, 1 cake, and 1 decoration.
– Hard-coding the values is prohibited; the code must use function return values.
– 5%: Drawing fits within the canvas window without cutoff.
– 5%: Fills shapes with colors, and border lines match fill colors.
– 5%: Displays the drawing for the user to view before exiting the program.
10%: Style and Documentation: The code must follow the style guidelines. For example, the
code should be commented; there should be a file docstring as well as function docstrings.
Off-the-top Deductions
– 50%: The program is one long function that draws the entire scene.
– 20%: Failure to follow submission requirements may include up to 10%: for incorrect file
names or use of zip, and 10%: for incorrect use of Python version 2 instead of version 3.
Submission
1. Save with the appropriate internal documentation (i.e. comments & docstring) as
scenery.py;
2. Upload scenery.py to BOTH the MyCourses Assignment box and GitHub classroom. Only
if you got errors over the type of file you can submit a zipped version (zip format)
1
1. Problem
This activity involves writing functions that use Python Turtle commands to draw pictures and
requires an understanding of fundamental program mechanisms, including Program Behavior.
The goal of this assignment is to use Python’s turtle graphics module, to design a program that
draws a birthday cake on a table.
2. Descriptions
You are asked to develop a Python program to draw a birthday cake with a candle on a table.
The layout is your decision.
The program will interact with the user. It will ask the user the color, size of the table, and size of
the cake. It will draw a table of the given size and color. The cake should be placed on the table
with a candle on it.
You may embellish and expand to draw more decorations on the cake as desired (see the
picture below).
The program must pause after drawing the figures and wait for the user to close the drawing
canvas window.
Example terminal output:
Please enter the length of one side of a table (between 10-100): 39
Please enter the color of the table: White
Please enter the size of the cake (between 10-100) Note that the cake
size should be equal to or smaller than the table size: 10
Your cake is loading! Happy Birthday!
Press any key to exit …
2
3. Problem-solving Session (15%)
Work in a team of 3 students. You need to continue working after the class with your
teammates to finish all requirements. Below is a list that will help you determine what you will
need to do on your own. Tasks:
• Create the file scenery.py for your solution. (5%)
• Write docstrings for the file. (5%)
• Write functions for each part as you develop it. (5%)
During problem-solving, do not worry about filling figures with color.
1. Write a Python function to draw a square/rectangle table, and use parameters to
specify the side length and color. The turtle must end in the same location and orientation
in which it started.
2. Write a Python function to draw a cake, and use parameters to specify the radius. The
turtle must end in the same location and orientation in which it started.
3. Write a Python function to draw a candle on the cake.
4. Write a main function and reuse the functions created in the first 3 tasks. The turtle must
end in the same location and orientation in which it started.
4. Implementation (85%)
Each Group will submit their own solution to the problem as a Python program named scenery.py.