How to draw Broken Heart using Python
Day 1 | Project 1
ᴄᴏᴅᴇ ᴡɪᴛʜ ɴɪᴄᴋ
Hello there. I'm Prince. I started coding in 2022 and now, I can write different codes. Here is the python code for creating Broken Heart drawing.
In this quick tutorial, I’ll show you how to create Broken Heart drawing with Python. It’s simple, it’s fast, and it’s easy.
Copy this code and run this in your system. I hope this project will be helpful and easy to understand for you.
code:
#Python Code to draw
#Broken Heart
#@code_with.nick
import turtle
s = turtle.Screen().bgcolor("black")
t = turtle.Turtle()
t.speed(3)
t.width(12)
def curve():
for i in range (200):
t.right(1)
t.forward(1)
def heart():
t.color("red","red")
t.begin_fill()
t.left(140)
t.forward(113)
curve()
t.left(120)
curve()
t.forward(112)
t.end_fill()
heart()
t.pencolor("black")
t.penup()
t.goto(0,170)
t.pendown()
for broken in range (3):
t.left(75)
t.forward(40)
t.right(65)
t.forward(45)
turtle.done()
Output:
Our code is complete. Use this code and the output will be shocking.
Thankyou for reading this article. Hope you like this code trick. Please follow us on Instagram : @code_with.nick
Comments
Post a Comment