Skip to content

Commit 52cac87

Browse files
committed
Rebuild site
1 parent 64277dd commit 52cac87

16 files changed

+680
-354
lines changed

en/_sources/conditional_loops.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ a ``while`` loop, and some new turtle functions:
3232
* ``turtle.towards(0,0)`` - The angle to get back to origin
3333
* ``turtle.setheading(angle)`` - Directly set the turtle direction
3434

35-
Now you will need to implement the prison logic using the API calls
36-
above, a ``while`` loop and a bit of conditional logic. It's a bit of
37-
a stretch but keep at it! Don't be afraid to talk it out with a coach
38-
or another student.
35+
Now you will need to implement the prison logic using these turtle
36+
functions, a ``while`` loop and a bit of conditional logic. It's a bit
37+
of a stretch but keep at it! Don't be afraid to talk it out with a
38+
coach or another student.
3939

4040

4141
Solution

en/_sources/functions.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,26 @@ Solution
7575
turtle.forward(50)
7676
turtle.left(90)
7777

78-
angle = 20 # <--
78+
# Set the angle we want to use for our square
79+
angle = 20
7980
tilted_square()
8081
tilted_square()
8182
tilted_square()
8283

84+
Comments
85+
--------
86+
87+
In the solution above, the line that starts with a ``#`` is called a
88+
comment. In Python, anything that goes on a line after ``#`` is ignored
89+
by the computer. Use comments to explain what your program does,
90+
without changing the behaviour for the computer.
91+
92+
Comments can also go at the end of a line, like this:
93+
94+
::
95+
96+
angle = 20 # Set the angle we want to use for our square
97+
8398

8499
A function for a hexagon
85100
========================

en/_sources/getting_started.txt

Lines changed: 77 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,74 @@
11
Getting started
22
***************
33

4-
Starting Python
5-
===============
4+
After you've installed Python, steps for launching it depend on which
5+
OS you are using:
66

7-
After installing Python on your system successfully, you can start the
8-
interactive Python prompt by typing :program:`python` in the command line and
9-
pressing :kbd:`<Enter>`. It will show you some context information about
10-
Python similar to this::
7+
Starting Python on Mac OS X
8+
===========================
119

12-
Python 2.7.2 (default, Feb 1 2012, 00:28:57)
13-
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
14-
Type "help", "copyright", "credits" or "license" for more information.
15-
>>>
10+
To start Python on OS X you first need to launch a command line terminal. Do this by
11+
navigating to Applications, then Utilities, then double-click the
12+
"Terminal" program.
1613

14+
The command line Terminal is a tool for interacting with your
15+
computer. A window will open with a command line prompt message,
16+
something like this::
17+
18+
myname ~$
19+
20+
.. note:: Take note of the dollar sign $ at the end of the
21+
prompt. This tells you that you are using the system command
22+
line. We'll be using two different interactive environments today,
23+
the system command line (with this prompt) and the Python
24+
interactive shell (which we'll see shortly.)
25+
26+
To launch Python from the system command line type :program:`python` and
27+
then press :kbd:`<Enter>`
28+
29+
Starting Python on Linux
30+
========================
31+
32+
To start Python on Linux you first need to launch a command line terminal
33+
program. Exactly how to do this depend on what Linux desktop
34+
environment you are using, but try searching for Terminal in your
35+
computer's program launcher interface.
36+
37+
The command line terminal is a tool for interacting with your
38+
computer. A window will open with a command line prompt message, something
39+
like this::
40+
41+
myname@mycomputer:~$
1742

18-
.. note::
1943

20-
On Windows you can open Python through the Start Menu.
44+
.. note:: Take note of the dollar sign $ at the end of the
45+
prompt. This tells you that you are using the system command
46+
line. We'll be using two different interactive environments today,
47+
the system command line (with this prompt) and the Python
48+
interactive shell (which we'll see shortly.)
49+
50+
To launch Python from the system command line type :program:`python` and
51+
then press :kbd:`<Enter>`
52+
53+
Starting Python on Windows
54+
==========================
55+
56+
On Windows you can launch Python through the Start menu.
57+
58+
59+
Interacting With Python
60+
=======================
61+
62+
After Python opens, it will show you some contextual information similar to this::
63+
64+
Python 2.7.2 (default, Feb 1 2012, 00:28:57)
65+
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
66+
Type "help", "copyright", "credits" or "license" for more information.
67+
>>>
2168

22-
Those three ``>>>`` in the last line indicate that you are now in the
23-
interactive shell of Python. It is waiting for your commands::
69+
The prompt ``>>>`` on the last line indicates that you are now in an
70+
interactive Python session, also called the "Python shell". It is
71+
waiting for your commands::
2472

2573
print("Hello world")
2674

@@ -46,24 +94,27 @@ Let's try that. Create a file :file:`hello.py` in your current directory with
4694
your favorite text editor and paste the print command from above. Now save
4795
that file.
4896

49-
On Mac OSX and Linux go back the command line and type:
97+
On Mac OS X and Linux go back to the system command line (where the
98+
prompt ends with ``$`` not ``>>>``, use :kbd:`Ctrl-D` to exit Python if it is
99+
running) and type:
50100

51101
.. code-block:: bash
52102

53103
python hello.py
54104

55105
.. note::
56106

57-
Not getting "Hello world" but some crazy error about "can't open file" or
58-
"No such file or directory?" Probably your command line is not running in
59-
the directory you saved the file in; you can change your active directory
60-
with the :command:`cd` command::
107+
Not getting "Hello world" but some crazy error about "can't open
108+
file" or "No such file or directory?" Probably your command line
109+
is not running in the directory you saved the file in; you can use
110+
the system command line to change your active directory with the
111+
:command:`cd` command, which stands for "change directory"::
61112

62113
cd Python_Exercises
63114

64115
This changes to the subdirectory Python_Exercises of the currently active
65-
directory. If you don't know which directory your shell is currently
66-
running in use :command:`pwd`.
116+
directory. If you don't know which directory you are currently in then
117+
running in then use :command:`pwd`,which stands for "print working directory".
67118

68119
On Windows you can double-click the Python file to run it.
69120

@@ -73,11 +124,11 @@ that file it exits instead of going back to the interactive shell.
73124

74125
.. tip::
75126

76-
Wordpad, TextEdit, Notepad, and Word are **not** suitable text editors. If
77-
you are unsure whether you already have a usable editor, you might want to
78-
download and install `Sublime Text <http://www.sublimetext.com/>`_.
79-
Sophisticated editors like this also take care of identation and help you
80-
run and debug your code.
127+
Wordpad, TextEdit, Notepad, and Word are **not** suitable text
128+
editors. If you are unsure whether you already have a usable
129+
editor, you might want to download and install `Sublime Text
130+
<http://www.sublimetext.com/>`_. Sophisticated editors like this
131+
can also help you with formatting, running and debugging your code.
81132

82133
And now we are all set and can get started with turtle!
83134

en/_sources/simple_drawing.txt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ until you click on it::
6262

6363
turtle.exitonclick()
6464

65+
.. note::
66+
67+
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 will cause an unexpected error.
68+
6569
Drawing a square
6670
================
6771

@@ -107,7 +111,15 @@ Python shell. If there is a lot of text, Python will put the help text
107111
into a *pager*, which lets you page up and down. Press the :kbd:`q`
108112
key to exit the pager.
109113

110-
Alternatively, browse the `online documentation`__.
114+
.. tip::
115+
116+
Are you seeing an error like this::
117+
118+
NameError: name 'turtle' is not defined``
119+
120+
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 ``import turtle`` before ``help(turtle.color)`` will work.
121+
122+
Another way to find out about functions is to browse the `online documentation`__.
111123

112124
__ http://docs.python.org/library/turtle
113125

@@ -176,7 +188,7 @@ Solution
176188

177189
::
178190

179-
turtle.left(20) # <--
191+
turtle.left(20)
180192

181193
turtle.forward(50)
182194
turtle.left(90)
@@ -187,7 +199,7 @@ Solution
187199
turtle.forward(50)
188200
turtle.left(90)
189201

190-
turtle.left(20) # <--
202+
turtle.left(20)
191203

192204
turtle.forward(50)
193205
turtle.left(90)
@@ -198,7 +210,7 @@ Solution
198210
turtle.forward(50)
199211
turtle.left(90)
200212

201-
turtle.left(20) # <--
213+
turtle.left(20)
202214

203215
turtle.forward(50)
204216
turtle.left(90)

en/_sources/variables.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ Solution
6767
turtle.left(90)
6868

6969
turtle.left(angle)
70-
# ...
70+
71+
72+
... and so on
7173

7274
Bonus
7375
-----

en/_static/pygments.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
.highlight .gr { color: #FF0000 } /* Generic.Error */
1414
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
1515
.highlight .gi { color: #00A000 } /* Generic.Inserted */
16-
.highlight .go { color: #303030 } /* Generic.Output */
16+
.highlight .go { color: #333333 } /* Generic.Output */
1717
.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
1818
.highlight .gs { font-weight: bold } /* Generic.Strong */
1919
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
20-
.highlight .gt { color: #0040D0 } /* Generic.Traceback */
20+
.highlight .gt { color: #0044DD } /* Generic.Traceback */
2121
.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
2222
.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
2323
.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */

en/_static/searchtools.js

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,13 @@ var Search = {
239239
},
240240

241241
loadIndex : function(url) {
242-
$.ajax({type: "GET", url: url, data: null, success: null,
243-
dataType: "script", cache: true});
242+
$.ajax({type: "GET", url: url, data: null,
243+
dataType: "script", cache: true,
244+
complete: function(jqxhr, textstatus) {
245+
if (textstatus != "success") {
246+
document.getElementById("searchindexloader").src = url;
247+
}
248+
}});
244249
},
245250

246251
setIndex : function(index) {
@@ -301,7 +306,7 @@ var Search = {
301306
},
302307

303308
query : function(query) {
304-
var stopwords = ["and","then","into","it","as","are","in","if","for","no","there","their","was","is","be","to","that","but","they","not","such","with","by","a","on","these","of","will","this","near","the","or","at"];
309+
var stopwords = ["a","and","are","as","at","be","but","by","for","if","in","into","is","it","near","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"];
305310

306311
// Stem the searchterms and add them to the correct list
307312
var stemmer = new Stemmer();
@@ -457,16 +462,18 @@ var Search = {
457462
displayNextItem();
458463
});
459464
} else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
460-
$.get(DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' +
461-
item[0] + '.txt', function(data) {
462-
if (data != '') {
463-
listItem.append($.makeSearchSummary(data, searchterms, hlterms));
464-
Search.output.append(listItem);
465-
}
466-
listItem.slideDown(5, function() {
467-
displayNextItem();
468-
});
469-
}, "text");
465+
$.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[0] + '.txt',
466+
dataType: "text",
467+
complete: function(jqxhr, textstatus) {
468+
var data = jqxhr.responseText;
469+
if (data !== '') {
470+
listItem.append($.makeSearchSummary(data, searchterms, hlterms));
471+
}
472+
Search.output.append(listItem);
473+
listItem.slideDown(5, function() {
474+
displayNextItem();
475+
});
476+
}});
470477
} else {
471478
// no source available, just display title
472479
Search.output.append(listItem);

0 commit comments

Comments
 (0)