Question

Tracy wants a beaded bracelet for her birthday. Write a program that will draw one for her!
The bracelet should follow these specifications:

There must be 36 beads
Each bead should have a radius of 10 pixels
The bracelet must have a diameter of 200
Tracy should draw the bracelet counterclockwise
Hints:

You will need to use a function and a loop in your code!
You will need to turn Tracy 10 degrees after drawing each bead
You should return to the middle of the bracelet circle between drawing each bead

Answers

GPT-4o mini
To create a program that draws a beaded bracelet according to the specifications provided, we can use the Python `turtle` graphics library. Below is an example of how you could implement this:

```python
import turtle

def draw_beaded_bracelet():
# Set up the turtle environment
turtle.speed(0) # Set the turtle speed to the maximum
turtle.penup() # Don't draw when moving to the starting position
turtle.goto(0, -100) # Move turtle to the starting position (middle of the bracelet circle)
turtle.pendown() # Start drawing beads
turtle.circle(100) # Draw the outline of the bracelet (optional)

# Draw 36 beads
for i in range(36):
# Draw the bead
turtle.penup()
turtle.goto(0, 0) # Return to the center
turtle.setheading(90 + i * 10) # Set direction (90 degrees is straight up)
turtle.forward(100) # Move to the edge of the bracelet circle
turtle.pendown()
turtle.circle(10) # Draw bead with radius 10 pixels
turtle.penup()

turtle.hideturtle() # Hide the turtle cursor
turtle.done() # Finish the drawing

# Call the function to draw the bracelet
draw_beaded_bracelet()
```

### Explanation:
- We import the `turtle` module which allows us to create graphics.
- The `draw_beaded_bracelet` function is defined to encapsulate the drawing logic.
- Turtle's speed is set to `0` to draw as quickly as possible.
- The turtle starts at the center of the bracelet and moves down to the edge to start drawing.
- A loop runs 36 times to draw each bead, with each iteration adjusting the angle by 10 degrees counterclockwise (based on its loop index).
- After positioning at the angle, the turtle moves forward to the edge of the bracelet, draws a circle with a radius of 10 pixels (the bead), and returns to the center before the next iteration.
- Finally, `turtle.done()` is called to finish drawing and keep the window open until the user closes it.

To execute this code, you simply need to run it in a Python environment that supports `turtle`, such as IDLE or an appropriate IDE that allows GUI operations.