Question: Write a program called draw_shapes.py . In your program, Create a block header with: your name the date a short description of what the program
Write a program called draw_shapes.py.
In your program,
- Create a block header with:
- your name
- the date
- a short description of what the program does: Assignment 5: Draw shapes using turtle
- Import the turtle module.
- Create a window and screen (canvas) where your turtle will draw. Make the window 400 pixels wide x 400 pixels high and give it an indigo background and a title of "Shapes". Use this code to create a window object: # a place for the turtle to draw win = turtle.Screen() # create a window object
- Create a turtle object and give it a name.
- Draw the following shapes. You may use 'for' loops or repetitive code depending on your comfort level with 'for' loops. Do not draw a line from one shape to the next Hint: penup(), goto(), and pendown()
- A yellow-filled hexagon (six sides) starting at location (80,80) that has sides of length 40 pixels. Hints:
- for i in range(6):
- For a 6 sided object with equal sides turn 360/6 = 60 degrees at the end of each side before drawing the next side
- A light green filled octagon (eight sides) starting at location (-20,20) that has sides of length 30. An octagon has 8 sides. Hints:
- for i in range(8):
- Turn 360/8 = 45 degrees at the end of each side
- A pink filled triangle (three sides) starting at location (80, -120) that has sides of length 70. Hints:
- for i in range(3):
- Turn 360/3 = 120 degrees at the end of each side
- A yellow-filled hexagon (six sides) starting at location (80,80) that has sides of length 40 pixels. Hints:
- Add a statement to exit your program on a mouse click.
Save and run your program.
It should look like this:
Upload only your draw_shapes.py to this assignment. A screenshot is not necessary.
After instruction number 3 IDK what to type. After that, I get confused about what order should I put code in and I'm new using Py. Please help me out with this difficult Homework. thanks in advance.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
