Python 使用 turtle 库
```python
import turtle
def draw_heart():
screen = turtle.Screen()
screen.title("爱心代码")
screen.bgcolor("white")
love = turtle.Turtle()
love.shape("turtle")
love.color("red")
love.speed(1)
love.begin_fill()
love.left(140)
love.forward(224)
love.circle(-112, 200)
love.left(120)
love.circle(-112, 200)
love.forward(224)
love.end_fill()
love.hideturtle()
turtle.done()
draw_heart()
```
Python 使用 matplotlib 库
```python
import matplotlib.pyplot as plt
import numpy as np
def draw_heart():
t = np.linspace(0, 2 * np.pi, 100)
x = 160 * np.sin(t)
y = 160 * (np.cos(t) - 1)
plt.plot(x, y, color='red', linewidth=2)
plt.axis('equal')
plt.show()
draw_heart()
```
JavaScript 使用 HTML5 Canvas
```html