random pyhton code
import turtle
# Set up the screen
screen = turtle.Screen()
screen.bgcolor("white")
# Create a turtle object
heart = turtle.Turtle()
heart.shape("turtle")
heart.speed(5)
# Function to draw a heart
def draw_heart():
heart.color("red")
heart.begin_fill()
heart.left(50)
heart.forward(133)
heart.circle(50, 200)
heart.right(140)
heart.circle(50, 200)
heart.forward(133)
heart.end_fill()
# Move the turtle to the starting position
heart.penup()
heart.goto(0, -150)
heart.pendown()
# Draw the heart shape
draw_heart()
# Hide the turtle after drawing
heart.hideturtle()
# Keep the window open
screen.mainloop()
0 comments:
Post a Comment