From ee29bbde7805d548a9c825268bf20075509cd2e8 Mon Sep 17 00:00:00 2001 From: erbrown Date: Mon, 22 Sep 2025 20:27:54 -0400 Subject: [PATCH] I created blocks of code for letters a, b, c, d by using the forward, right, left, penup, pendown commands I am sorry for submitting all my code at once. I was working on the letters and got to the bottom of the submission page and read that I should submit after I got each letter. Honestly I am feeling great at first I was a little confused on what I had to do but then once I got the first letter it was not that bad. I enjoyed doing this code and it is fun to create the letters. --- test.py | 40 +++++++++++++ typeface.py | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 206 insertions(+), 4 deletions(-) diff --git a/test.py b/test.py index 3703e2d..14dd32d 100644 --- a/test.py +++ b/test.py @@ -39,4 +39,44 @@ color(LETTER_COLOR) pensize(LETTER_SIZE) letter_function(UNIT) +def draw_letter_d(unit): + penup() + forward(unit) + pendown() + forward(unit*4) + left(45) + forward(unit * sqrt(2) *2) + left(45) + forward(unit *4) + left(45) + forward(unit * sqrt(2) *2) + left(45) + forward(unit *4) + left(90) + forward(unit *8) + penup() + left(90) + forward(unit *2) + left(90) + forward(unit *2) + right(90) + pendown() + forward(unit) + left(45) + forward(unit * sqrt(2)) + left(45) + forward(unit *2) + left(45) + forward(unit * sqrt(2)) + left(45) + forward(unit) + left(90) + forward(unit *4) + penup() + forward(unit *2) + right(90) + forward(unit *3) + right(180) + + input() diff --git a/typeface.py b/typeface.py index b966bef..941387a 100644 --- a/typeface.py +++ b/typeface.py @@ -13,16 +13,178 @@ from turtle import * from math import sqrt def draw_letter_a(unit): - pass + penup() + forward(unit * 1) + pendown() + left(90) + forward(unit * 6) + right(45) + forward(unit * sqrt(2)* 2) + right(45) + forward(unit * 2) + right(45) + forward(unit * sqrt(2)* 2) + right(45) + forward(unit * 6) + right(90) + forward(unit * 2) + right(90) + forward(unit * 3) + left(90) + forward(unit * 2) + penup() + right(90) + forward(unit *1) + pendown() + forward(unit*1) + right(45) + forward(unit * sqrt(2)) + right(90) + forward(unit * sqrt(2)) + right(45) + forward(unit *1) + right(90) + forward(unit *2) + penup() + left(90) + forward(unit *1) + pendown() + forward(unit * 3) + right(90) + forward(unit * 2) + penup() + forward(unit *1) + right(180) + pendown + def draw_letter_b(unit): - pass + penup() + forward(unit *1) + pendown() + forward(unit *4) + left(45) + forward(unit * sqrt(2) * 2) + left(90) + forward(unit * sqrt(2) *2) + right(90) + forward(unit *sqrt(2) *2) + left(90) + forward(unit * sqrt(2) *2) + left(45) + forward(unit *4) + left(90) + forward(unit *8) + penup() + left(90) + forward(unit *2) + left(90) + forward(unit*1) + right(90) + pendown() + forward(unit *1) + left(45) + forward(unit * sqrt(2)) + left(90) + forward(unit * sqrt(2)) + left(45) + forward(unit) + left(90) + forward(unit * 2) + left(180) + penup() + forward(unit *4) + pendown() + right(90) + forward(unit *1) + left(45) + forward(unit * sqrt(2)) + left(90) + forward(unit * sqrt(2)) + left(45) + forward(unit) + left(90) + forward(unit * 2) + penup() + forward(unit *5) + right(90) + forward(unit *3) + left(180) + def draw_letter_c(unit): - pass + penup() + forward(unit*3) + pendown() + left(135) + forward(unit * sqrt(2) * 2) + right(45) + forward(unit *4) + right(45) + forward(unit * sqrt(2) * 2) + right(45) + forward(unit *4) + right(90) + forward(unit * 2) + right(90) + forward(unit *3) + left(45) + forward(unit * sqrt(2)) + left(45) + forward(unit *2) + left(45) + forward(unit * sqrt(2)) + left(45) + forward(unit *3) + right(90) + forward(unit *2) + right(90) + forward(unit *4) + penup() + forward(unit *3) + right(180) + def draw_letter_d(unit): - pass + penup() + forward(unit) + pendown() + forward(unit*4) + left(45) + forward(unit * sqrt(2) *2) + left(45) + forward(unit *4) + left(45) + forward(unit * sqrt(2) *2) + left(45) + forward(unit *4) + left(90) + forward(unit *8) + penup() + left(90) + forward(unit *2) + left(90) + forward(unit *2) + right(90) + pendown() + forward(unit) + left(45) + forward(unit * sqrt(2)) + left(45) + forward(unit *2) + left(45) + forward(unit * sqrt(2)) + left(45) + forward(unit) + left(90) + forward(unit *4) + penup() + forward(unit *2) + right(90) + forward(unit *3) + right(180) + + def draw_letter_e(unit): pass