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___________ # 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 * from turtle import *
r=40 def tadpole (radius,colour): # "I name half of yinyang shape tadpole"
left(70) color("black", colour) # British spellings for colour to distinguish this from color"
color("black", "red") begin_fill()
begin_fill() circle(radius,180) # half circle
circle(r,180) # half circle circle(-radius,180) # another half circle
circle(-r,180) # another half circle circle(-radius*2,180)
circle(-r*2,180) end_fill()
end_fill()
color("black", "blue") right(15)
begin_fill() left(90)
circle(-r*2,180) tadpole (40, "red")
right(180) right(90)
circle(r,180) # half circle penup()
circle(-r,180) # another half circle forward(160)
pendown()
left(90)
tadpole (40, "blue")
end_fill()
input() input()