I made a red octagon with the word STOP inside to mimic a stop sign.

I felt determined to learn some other codes that were not mentioned in the article. I imported the code 'write' and 'set position' in order to add the word STOP and to make it go inside of the octagon. Although I was able to figure out the codes, I became determined to make the word STOP as center as possible in the octagon, which took many trials and errors to get it as close as I could.
This commit is contained in:
Diana Panarello 2024-09-03 19:18:52 -04:00
parent 1ee977b290
commit 2fb9473b08
1 changed files with 18 additions and 5 deletions

View File

@ -6,17 +6,30 @@ from turtle import (
penup,
pendown,
color,
write,
setposition
)
color('red')
right(45)
forward(100)
right(360 * 2 / 5)
right(45)
forward(100)
right(360 * 2 / 5)
right(45)
forward(100)
right(360 * 2 / 5)
right(45)
forward(100)
right(360 * 2 / 5)
right(45)
forward(100)
right(360 * 2 / 5)
right(45)
forward(100)
right(45)
forward(100)
right(45)
forward(100)
penup()
setposition(-145,-160)
style = ('Times New Roman', 75, 'bold')
write('STOP', font=style)
input()