pycharm能编译出的爱心代码
时间: 2023-05-22 08:03:41 浏览: 150
Sure, here's a sample code in Python that will draw a heart in Pycharm:
```python
import math
def drawHeart():
for i in range(0, 360):
angle = i * math.pi / 180
x = 16 * (math.sin(angle) ** 3)
y = 13 * math.cos(angle) - 5 * math.cos(2 * angle) - 2 * math.cos(3 * angle) - math.cos(4 * angle)
print(" ", "x" if y < 0 else " ", end="")
if i % 30 == 0:
print()
drawHeart()
```
Hope this helps!
阅读全文