Repository navigation
Expand file tree
/
Copy pathsimple_drawing.html
More file actions
446 lines (405 loc) · 26.2 KB
/
Copy pathsimple_drawing.html
File metadata and controls
446 lines (405 loc) · 26.2 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Simple drawing with turtle — Introduction to Programming with Python</title>
<link rel="stylesheet" href="_static/basic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
<link rel="stylesheet" href="_static/bootstrap-3.3.4/css/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="_static/bootstrap-3.3.4/css/bootstrap-theme.min.css" type="text/css" />
<link rel="stylesheet" href="_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '2015.11.01',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/spoilers.js"></script>
<script type="text/javascript" src="_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="_static/bootstrap-sphinx.js"></script>
<link rel="copyright" title="Copyright" href="copyright.html" />
<link rel="top" title="Introduction to Programming with Python" href="index.html" />
<link rel="next" title="Variables" href="variables.html" />
<link rel="prev" title="Getting started" href="getting_started.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<div id="navbar" class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">
Python for Beginners</a>
<span class="navbar-text navbar-version pull-left"><b>2015.11.01</b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="index.html">Material <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul class="current">
<li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting started</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">Simple drawing with turtle</a></li>
<li class="toctree-l1"><a class="reference internal" href="variables.html">Variables</a></li>
<li class="toctree-l1"><a class="reference internal" href="loops.html">Loops</a></li>
<li class="toctree-l1"><a class="reference internal" href="functions.html">User-defined functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="functions_parameters.html">Functions with parameters</a></li>
<li class="toctree-l1"><a class="reference internal" href="conditionals.html">Conditional statements</a></li>
<li class="toctree-l1"><a class="reference internal" href="conditional_loops.html">Conditional Loops</a></li>
<li class="toctree-l1"><a class="reference internal" href="logical_operators.html">Logical operators</a></li>
<li class="toctree-l1"><a class="reference internal" href="where_to_go.html">Where to go from here</a></li>
<li class="toctree-l1"><a class="reference internal" href="copyright.html">License</a></li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Chapter <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">Simple drawing with turtle</a><ul>
<li><a class="reference internal" href="#introduction">Introduction</a></li>
<li><a class="reference internal" href="#drawing-a-square">Drawing a square</a><ul>
<li><a class="reference internal" href="#exercise">Exercise</a></li>
<li><a class="reference internal" href="#solution">Solution</a></li>
<li><a class="reference internal" href="#bonus">Bonus</a></li>
</ul>
</li>
<li><a class="reference internal" href="#drawing-a-rectangle">Drawing a rectangle</a><ul>
<li><a class="reference internal" href="#id1">Exercise</a></li>
<li><a class="reference internal" href="#id2">Solution</a></li>
<li><a class="reference internal" href="#id3">Bonus</a></li>
</ul>
</li>
<li><a class="reference internal" href="#more-squares">More squares</a><ul>
<li><a class="reference internal" href="#id4">Exercise</a></li>
<li><a class="reference internal" href="#id5">Solution</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</ul>
</li>
<li class="navbar-rel">
<a href="getting_started.html" title="Previous Chapter: Getting started">
<span class="glyphicon glyphicon-step-backward"></span>
<span>Previous</span>
</a>
</li>
<li class="navbar-rel">
<a href="variables.html" title="Next Chapter: Variables">
<span class="glyphicon glyphicon-step-forward"></span>
<span>Next</span>
</a>
</li>
<li class="dropdown">
<a role="button"
data-toggle="dropdown"
data-target="#"
href="#">Languages <b class="caret"></b></a>
<ul class="dropdown-menu"
role="menu">
<li><a href="../en/index.html">English</a></li>
<li><a href="../de/index.html">Deutsch (German)</a></li>
<li><a href="../es_CL/index.html">Español (Spanish)</a></li>
<li><a href="../ru/index.html">русский (Russian)</a></li>
<li><a href="../ko/index.html">한국인 (Korean)</a></li>
<li><a href="../ro/index.html">Română (Romanian)</a></li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-right" action="search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="section" id="simple-drawing-with-turtle">
<h1>Simple drawing with turtle<a class="headerlink" href="#simple-drawing-with-turtle" title="Permalink to this headline">¶</a></h1>
<div class="section" id="introduction">
<h2>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h2>
<p>“Turtle” is a python feature like a drawing board, which lets you command
a turtle to draw all over it!</p>
<p>You can use functions like <code class="docutils literal"><span class="pre">turtle.forward(...)</span></code> and <code class="docutils literal"><span class="pre">turtle.left(...)</span></code>
which can move the turtle around.</p>
<p>Before you can use turtle, you have to import it. We recommend playing around
with it in the interactive interpreter first, as there is an extra bit of work
required to make it work from files. Just go to your terminal and type:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">turtle</span>
</pre></div>
</div>
<img alt="_images/default.png" src="_images/default.png" />
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Not seeing anything on Mac OS? Try issuing a command like
<code class="docutils literal"><span class="pre">turtle.forward(0)</span></code> and looking if a new window opened behind your
command line.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Do you work with Ubuntu and get the error message “No module named
_tkinter”? Install the missing package with <code class="docutils literal"><span class="pre">sudo</span> <span class="pre">apt-get</span> <span class="pre">install</span>
<span class="pre">python3-tk</span></code></p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">While it might be tempting to just copy and paste what’s written on
this page into your terminal, we encourage you to type out each command.
Typing gets the syntax under your fingers (building that muscle memory!)
and can even help avoid strange syntax errors.</p>
</div>
<div class="highlight-python"><div class="highlight"><pre><span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">25</span><span class="p">)</span>
</pre></div>
</div>
<img alt="_images/forward.png" src="_images/forward.png" />
<div class="highlight-python"><div class="highlight"><pre><span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">30</span><span class="p">)</span>
</pre></div>
</div>
<img alt="_images/left.png" src="_images/left.png" />
<p>The <code class="docutils literal"><span class="pre">turtle.forward(...)</span></code> function tells the turtle to move forward
by the given distance. <code class="docutils literal"><span class="pre">turtle.left(...)</span></code> takes a number of degrees which you
want to rotate to the left. There is also <code class="docutils literal"><span class="pre">turtle.backward(...)</span></code> and
<code class="docutils literal"><span class="pre">turtle.right(...)</span></code>, too.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Want to start fresh? You can type <code class="docutils literal"><span class="pre">turtle.reset()</span></code> to clear the drawing
that your <code class="docutils literal"><span class="pre">turtle</span></code> has made so far. We’ll go into more detail on
<code class="docutils literal"><span class="pre">turtle.reset()</span></code> in just a bit.</p>
</div>
<p>The standard turtle is just a triangle. That’s no fun! Let’s make it a turtle
instead with the <code class="docutils literal"><span class="pre">turtle.shape()</span></code> command:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">turtle</span><span class="o">.</span><span class="n">shape</span><span class="p">(</span><span class="s">"turtle"</span><span class="p">)</span>
</pre></div>
</div>
<p>So much cuter!</p>
<p>If you put the commands into a file, you might have recognized that the turtle
window vanishes after the turtle finished its movement. (That is because
Python exits when your turtle has finished moving. Since the turtle window
belongs to Python, it goes away as well.) To prevent that, just put
<code class="docutils literal"><span class="pre">turtle.exitonclick()</span></code> at the bottom of your file. Now the window stays open
until you click on it:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">turtle</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">shape</span><span class="p">(</span><span class="s">"turtle"</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">25</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">exitonclick</span><span class="p">()</span>
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Python is a programming language where horizontal indenting of text is
important. We’ll learn all about this in the Functions chapter later on,
but for now just keep in mind that stray spaces or tabs before any line
of Python code can cause an unexpected error. You could even try adding one
to check how python will complain!</p>
</div>
</div>
<div class="section" id="drawing-a-square">
<h2>Drawing a square<a class="headerlink" href="#drawing-a-square" title="Permalink to this headline">¶</a></h2>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">You’re not always expected to know the anwer immediately. Learn by
trial and error! Experiment, see what python does when you tell it
different things, what gives beautiful (although sometimes
unexpected) results and what gives errors. If you want to keep
playing with something you learned that creates interesting
results, that’s OK too. Don’t hesitate to try and fail and learn
from it!</p>
</div>
<div class="section" id="exercise">
<h3>Exercise<a class="headerlink" href="#exercise" title="Permalink to this headline">¶</a></h3>
<p>Draw a square as in the following picture:</p>
<img alt="_images/square.png" src="_images/square.png" />
<p>For a square you will probably need a right angle, which is 90 degrees.</p>
</div>
<div class="solution section" id="solution">
<h3>Solution<a class="headerlink" href="#solution" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><div class="highlight"><pre><span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Notice how the turtle starts and finishes in the same place and
facing the same direction, before and after drawing the
square. This is a useful convention to follow, it makes it easier
to draw multiple shapes later on.</p>
</div>
</div>
<div class="section" id="bonus">
<h3>Bonus<a class="headerlink" href="#bonus" title="Permalink to this headline">¶</a></h3>
<p>If you want to get creative, you can modify your shape with the
<code class="docutils literal"><span class="pre">turtle.width(...)</span></code> and <code class="docutils literal"><span class="pre">turtle.color(...)</span></code> functions. How do you
use these functions? Before you can use a function you need to know
its <em>signature</em> (for example what to put between the parentheses and what those
things mean.) To find this out you can type <code class="docutils literal"><span class="pre">help(turtle.color)</span></code> into the
Python shell. If there is a lot of text, Python will put the help text
into a <em>pager</em>, which lets you page up and down. Press the <code class="kbd docutils literal"><span class="pre">q</span></code>
key to exit the pager.</p>
<div class="admonition tip">
<p class="first admonition-title">Tip</p>
<p>Are you seeing an error like this:</p>
<div class="highlight-python"><div class="highlight"><pre>NameError: name 'turtle' is not defined
</pre></div>
</div>
<p class="last">when trying to view help? In Python you have to import names before you
can refer to them, so in a new Python interactive shell you’ll need to
<code class="docutils literal"><span class="pre">import</span> <span class="pre">turtle</span></code> before <code class="docutils literal"><span class="pre">help(turtle.color)</span></code> will work.</p>
</div>
<p>Another way to find out about functions is to browse the <a class="reference external" href="http://docs.python.org/3/library/turtle">online documentation</a>.</p>
<div class="admonition caution">
<p class="first admonition-title">Caution</p>
<p class="last">If you misdrew anything, you can tell turtle to erase its drawing board
with the <code class="docutils literal"><span class="pre">turtle.reset()</span></code> directive, or undo the most recent step with
<code class="docutils literal"><span class="pre">turtle.undo()</span></code>.</p>
</div>
<div class="admonition tip">
<p class="first admonition-title">Tip</p>
<p>As you might have read in the help, you can modify the color with
<code class="samp docutils literal"><span class="pre">turtle.color(</span><em><span class="pre">colorstring</span></em><span class="pre">)</span></code>. These include but are not limited to
“red,” “green,” and “violet.” See this <a class="reference external" href="http://www.tcl.tk/man/tcl8.5/TkCmd/colors.htm">colours manual</a> for an extensive
list.</p>
<p class="last">If you want to set an RGB value, make sure to run <code class="docutils literal"><span class="pre">turtle.colormode(255)</span></code>
first. Then for instance you could run <code class="docutils literal"><span class="pre">turtle.color(215,</span> <span class="pre">100,</span> <span class="pre">170)</span></code> to
set a pink colour.</p>
</div>
</div>
</div>
<div class="section" id="drawing-a-rectangle">
<h2>Drawing a rectangle<a class="headerlink" href="#drawing-a-rectangle" title="Permalink to this headline">¶</a></h2>
<div class="section" id="id1">
<h3>Exercise<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h3>
<p>Can you draw a rectangle too?</p>
<img alt="_images/rectangle.png" src="_images/rectangle.png" />
</div>
<div class="solution section" id="id2">
<h3>Solution<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><div class="highlight"><pre><span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="id3">
<h3>Bonus<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h3>
<p>How about a triangle? In an equilateral triangle (a triangle with all
sides of equal length) each corner has an angle of 60 degrees.</p>
</div>
</div>
<div class="section" id="more-squares">
<h2>More squares<a class="headerlink" href="#more-squares" title="Permalink to this headline">¶</a></h2>
<div class="section" id="id4">
<h3>Exercise<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h3>
<p>Now, draw a tilted square. And another one, and another one. You can
experiment with the angles between the individual squares.</p>
<img alt="_images/tiltedsquares.png" src="_images/tiltedsquares.png" />
<p>The picture shows three 20 degree turns. But you could try 20, 30 and 40 degree
turns, for example.</p>
</div>
<div class="solution section" id="id5">
<h3>Solution<a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h3>
<div class="highlight-python"><div class="highlight"><pre><span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">20</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">30</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">40</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="mi">50</span><span class="p">)</span>
<span class="n">turtle</span><span class="o">.</span><span class="n">left</span><span class="p">(</span><span class="mi">90</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
<br/>
<ul id="sourcelink" class="list-inline">
<li>
<a href="https://github.com/opentechschool/python-beginners/edit/master/source/simple_drawing.rst" title="simple_drawing.rst">
Edit on Github
</a>
</li>
<li>
<a href="https://github.com/OpenTechSchool/python-beginners/issues/new?title=Problem+with+simple_drawing">
Report a problem
</a>
</li>
</ul>
</p>
<p>
© <a href="copyright.html">Copyright</a> 2012–2014, OpenTechSchool and contributors.<br/>
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.1.<br/>
</p>
</div>
</footer>
</body>
</html>