Files
problemset_typeface/typeface.py
juddin2 6fc788d4b9 I deleted all the function already written and chose to write a fuction to draw l, o, and z.
I felt frustrated because I couldn't get the letter to look similar to the actual alphabets.I finally made it look similar by inputing different numbers to see hoe it looks like.
2025-09-20 20:50:27 -04:00

51 lines
983 B
Python

# typeface.py
# By Chris Proctor and _________
# Contains one function for each letter in the English alphabet.
# Each function should draw its letter at a scale of `unit`, and then
# return back to the same position and heading where it started.
# Note: The `sqrt` function from math may be helpful--if you want to
# move the turtle along the diagonal of a square with side length x,
# the turtle should move a distance of sqrt(x)
from turtle import *
from math import sqrt
unit = 10
def draw_letter_l():
pendown()
left(90)
forward(unit * 4)
penup()
right(90)
def draw_letter_o():
pendown()
for i in range(4):
forward(unit * 4)
left(90)
penup()
def draw_letter_z():
pendown()
forward(unit * 6)
left(135)
forward(unit * sqrt(2) * 6)
right(135)
forward(unit * 6)
penup()
# spacing
draw_letter_l()
penup()
forward(unit * 8)
draw_letter_o()
penup()
forward(unit * 8)
draw_letter_z()
done()