forked from jeffmiller00/PlayingWithPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreatingACircle.py
More file actions
33 lines (26 loc) · 956 Bytes
/
creatingACircle.py
File metadata and controls
33 lines (26 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import turtle
from math import pi
wn = turtle.Screen()
tcircle = turtle.Turtle()
def mycircle(t,r):
'''Creates circle by taking two arguments "turtle object" and "diameter".'''
cirf = 2 * r * pi # calculating the circumference of the circle
fwd = cirf/100 # to forward the turtle 100 times on the circumference
for i in range(100):
t.forward(fwd)
t.right(3.6) # turn right 100 times to complete the circle 360 / 100
def cofc(t,r):
'''Creates circle of circle by taking two arguments
"turtle object" and "diameter".'''
coc_cirf = 2 * r * pi # calculating the circumference of the circle
fwd = coc_cirf / 50 # forward by the diameter of small circles
r_of_small_c = fwd / 2 # radious of small circles
t.speed(0)
for i in range(100):
mycircle(t,r_of_small_c)
t.up()
t.right(3.6)
t.forward(fwd)
t.down()
cofc(tcircle, 100)
wn.exitonclick()