I modified the code to draw a green heart with a

pink arrow going through it. This process included tasks such as roation, color changes and using the penup/pendown commands.

At first I felt a bit frustrated because I couldm't really figure out the UI, since I used Python only in Jupyter Notebook before.
I also felt confused when I was trying to figure out the initial oritentation of the "pen". Once I figured that out, it was smooth sailing.
It felt funny to need geometry after a long time not needing it. Once I was done, I felt happy!
This commit is contained in:
caglazir
2025-09-05 22:14:09 -04:00
parent 49edc2971e
commit 6a174f9dd7
2 changed files with 42 additions and 6 deletions

View File

@@ -1,3 +1,4 @@
import math
from turtle import (
forward,
back,
@@ -8,15 +9,43 @@ from turtle import (
color,
)
color("PaleGreen")
right(315)
forward(300)
left(45)
forward(100)
right(360 * 2 / 5)
left(45)
forward(100)
right(360 * 2 / 5)
left(45)
forward(100)
right(360 * 2 / 5)
left(45)
forward(100)
right(360 * 2 / 5)
right(90)
forward(100)
right(360 * 2 / 5)
left(45)
forward(100)
left(45)
forward(100)
left(45)
forward(100)
left(45)
forward(300)
left(45)
forward(60)
penup()
back(300/(math.sqrt(2)))
color("DeepPink")
pendown()
right(135)
back(600)
right(90)
forward(5)
right(135)
forward(5*(math.sqrt(2)))
right(90)
forward(5*(math.sqrt(2)))
right(135)
forward(5)
input()