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.
This commit is contained in:
Seoyeon Lee 2024-09-28 22:48:58 -04:00
parent 1a09cc4b18
commit cd13f96603
1 changed files with 17 additions and 16 deletions

View File

@ -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")
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(r,180) # half circle
circle(-r,180) # another half circle
circle(-r*2,180)
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()