repl.it
@CHanlon/

Nacel 1

Python (with Turtle)

No description

fork
loading
main.py
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#######################
#
# Circles, by Nadine
# Oct 25th, 2017
# CodeNiagara Workshop
# Modification of the Project One code.
#
#

import turtle


def draw_circle(t_name, color, size, x, y):
    t_name.penup()
    t_name.color(color)
    t_name.fillcolor(color)
    t_name.goto(x, y)
    t_name.pendown()
    t_name.begin_fill()
    t_name.circle(size)
    t_name.end_fill()


def circle_size(size):
    size = size / 2
    return size


claire = turtle.Turtle()
claire.speed(100)

# Top row, size 50, 4 Circles
draw_circle(claire, "pink", circle_size(100), -150, 150)
draw_circle(claire, "pink", circle_size(100), -50, 150)
draw_circle(claire, "pink", circle_size(100), 50, 150)
draw_circle(claire, "pink", circle_size(100), 150, 150)

# Row 2, size 25, 8 Circles
draw_circle(claire, "pink", 25, -175, 100)
draw_circle(claire, "pink", 25, -175, 100)
draw_circle(claire, "pink", 25, -125, 100)
draw_circle(claire, "pink", 25, -75, 100)
draw_circle(claire, "pink", 25, -25, 100)
draw_circle(claire, "pink", 25, 25, 100)
draw_circle(claire, "pink", 25, 75, 100)
draw_circle(claire, "pink", 25, 125, 100)
draw_circle(claire, "pink", 25, 175, 100)
# Do you see the mistake, above? It's not serious, but its there

# Row 3, size 12.5, 16 Circles
draw_circle(claire, "pink", 12.5, -187.5, 75)
draw_circle(claire, "pink", 12.5, -162.5, 75)
draw_circle(claire, "pink", 12.5, -137.5, 75)
draw_circle(claire, "pink", 12.5, -112.5, 75)
draw_circle(claire, "pink", 12.5, -87.5, 75)
draw_circle(claire, "pink", 12.5, -62.5, 75)
draw_circle(claire, "pink", 12.5, -37.5, 75)
draw_circle(claire, "pink", 12.5, -12.5, 75)
draw_circle(claire, "pink", 12.5, 12.5, 75)
draw_circle(claire, "pink", 12.5, 37.5, 75)
draw_circle(claire, "pink", 12.5, 62.5, 75)
draw_circle(claire, "pink", 12.5, 87.5, 75)
draw_circle(claire, "pink", 12.5, 112.5, 75)
draw_circle(claire, "pink", 12.5, 137.5, 75)
draw_circle(claire, "pink", 12.5, 162.5, 75)
draw_circle(claire, "pink", 12.5, 187.5, 75)

# Row 4, size 6.25, 32 circles.
for i in range(32):
    draw_circle(claire, "pink", 6.25, -193.75+12.5*i, 62.5)
# Use of a for loop is awesome.  It saves having to copy/paste
# 32 lines of code.

# I think this is really great work.  But there are a few things that
# can be done more efficiently.  Nadine is totally on the right track
# and she's started to make tweaks in the right direction.
# I'm going to rewrite this the way that I'd write it. I don't like
# doing math when the computer could do it for me. :-)
result
console
?