在不重复的位置绘制3个不同颜色和粗细的五角星。
时间: 2023-06-05 09:06:16 浏览: 43
Sure, I can help with that! Here's a code snippet to draw three five-pointed stars in different colors and thicknesses at different positions:
```python
import turtle
# Create a turtle object
t = turtle.Turtle()
# Set the initial position
t.penup()
t.goto(-200, 0)
t.pendown()
# Draw the first star
t.pensize(5)
t.fillcolor("red")
t.begin_fill()
for i in range(5):
t.forward(100)
t.right(144)
t.end_fill()
# Move to the next position
t.penup()
t.goto(0, 100)
t.pendown()
# Draw the second star
t.pensize(3)
t.fillcolor("green")
t.begin_fill()
for i in range(5):
t.forward(75)
t.right(144)
t.end_fill()
# Move to the last position
t.penup()
t.goto(150, -100)
t.pendown()
# Draw the third star
t.pensize(2)
t.fillcolor("blue")
t.begin_fill()
for i in range(5):
t.forward(50)
t.right(144)
t.end_fill()
# Hide the turtle object
t.hideturtle()
# Keep the window open until it is closed manually
turtle.done()
```
Hope this helps! Let me know if you have any other questions.