From cd13f966031897e057f1945e76cca9d03ad88894 Mon Sep 17 00:00:00 2001 From: Seoyeon Lee Date: Sat, 28 Sep 2024 22:48:58 -0400 Subject: [PATCH] I made a second attempt for the same work, the circle with yinyang shape with two colors. I tried to use a fuction. I name the fuction I use tadpole because the half of circle looks like a tadpole with a big head and a short tale. For the parameter of the tadpole was radius and color intially, but I ran into the error. So, I had to add 'u' and name it again colour. Since color was already fuction defined by turtle. I started with right 15 degrees to make more close to Korean flag. I wonder if it is possible to make the circle with red and blue I made can be spinning. If it's possble, can I decide how many times the circle spins and how fast it spins? My first attempt was fine, it showed the image I wanted to see, but I think this second attempt was better. --- drawing.py | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/drawing.py b/drawing.py index c880ed2..769bd78 100644 --- a/drawing.py +++ b/drawing.py @@ -2,26 +2,27 @@ # ---------- # By Seoyeon___________ # -# (center of Korean flag with two colors, red and blue) +# (second trial_use fuction_center of Korean flag with two colors) from turtle import * -r=40 -left(70) -color("black", "red") -begin_fill() -circle(r,180) # half circle -circle(-r,180) # another half circle -circle(-r*2,180) -end_fill() +def tadpole (radius,colour): # "I name half of yinyang shape tadpole" + color("black", colour) # British spellings for colour to distinguish this from color" + begin_fill() + circle(radius,180) # half circle + circle(-radius,180) # another half circle + circle(-radius*2,180) + end_fill() -color("black", "blue") -begin_fill() -circle(-r*2,180) -right(180) -circle(r,180) # half circle -circle(-r,180) # another half circle +right(15) +left(90) +tadpole (40, "red") +right(90) +penup() +forward(160) +pendown() +left(90) +tadpole (40, "blue") -end_fill() input()