Untitled
unknown
plain_text
9 months ago
1.1 kB
4
Indexable
import turtle
# Set up the screen
screen = turtle.Screen()
screen.bgcolor("white")
# Create the turtle
shark = turtle.Turtle()
shark.speed(3)
# Draw the shark body
shark.penup()
shark.goto(-100, -50)
shark.pendown()
shark.color("gray")
shark.begin_fill()
shark.circle(100, 180) # Top curve
shark.goto(50, -50) # Bottom line
shark.goto(-100, -50) # Closing the shape
shark.end_fill()
# Draw the tail
shark.penup()
shark.goto(50, -50)
shark.pendown()
shark.begin_fill()
shark.goto(90, -20) # Upper tail fin
shark.goto(70, -50) # Middle tail
shark.goto(90, -80) # Lower tail fin
shark.goto(50, -50) # Closing the tail
shark.end_fill()
# Draw the eye
shark.penup()
shark.goto(-50, 50)
shark.pendown()
shark.color("white")
shark.begin_fill()
shark.circle(10)
shark.end_fill()
shark.penup()
shark.goto(-50, 55)
shark.pendown()
shark.color("black")
shark.begin_fill()
shark.circle(5)
shark.end_fill()
# Draw the mouth
shark.penup()
shark.goto(-30, 10)
shark.pendown()
shark.color("black")
shark.setheading(-30)
shark.circle(20, 60) # Curved smile
# Hide turtle
shark.hideturtle()
# Keep window open
turtle.done()Editor is loading...
Leave a Comment