Skip to content

Commit 8ecbe61

Browse files
committed
Update english version
1 parent b945296 commit 8ecbe61

18 files changed

+243
-158
lines changed

en/_sources/getting_started.txt

Lines changed: 67 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ Python 3 is preferable, being the newest version out!
1616

1717
.. note::
1818

19-
On Windows, you'll want to add :program:`Python` to your path, so it
20-
can be found by other programs. To do this, navigate to your
21-
installation directory (:file:`C:\\Python33\\`), open the :file:`Tools`,
22-
then :file:`Scripts` folders, and run the :file:`win_add2path.py`
19+
On Windows, you'll want to add :program:`Python` to your PATH, so it
20+
can be found by other programs. With Python 3.5 or later, there should be
21+
and option to do this in the installer. Otherwise, you can navigate to your
22+
installation directory (:file:`C:\\Python34\\`), open the :file:`Tools`,
23+
then :file:`Scripts` folder, and run the :file:`win_add2path.py`
2324
file by double clicking on it.
2425

2526
And a Code Editor
@@ -32,6 +33,10 @@ favourite knife. To start off with, you'll just want a basic, easy-to-use one
3233
that doesn't get in your way, but is still effective at writing python code.
3334
Here are some suggestions for those:
3435

36+
- `Atom`_: A new code editor available for Windows, Mac and Linux. It's
37+
an open-source project developed by GitHub and is very easy to add
38+
functionality for, with its packages system.
39+
3540
- `Sublime Text`_: A great all around editor that's easy to use. It's Ctl+B
3641
shortcut lets you run the python file you're working on straight away. Runs
3742
on Windows, Mac and Linux.
@@ -48,6 +53,7 @@ Here are some suggestions for those:
4853
- `Komodo Edit`_: a sleak, free editor for Mac, Windows and Linux, based on the
4954
more powerful Komodo IDE.
5055

56+
.. _Atom: https://atom.io
5157
.. _Sublime Text: http://www.sublimetext.com/
5258
.. _Geany: http://www.geany.org/
5359
.. _TextMate: http://macromates.com/
@@ -59,25 +65,24 @@ If you'd like our recommendation, try out Sublime Text first.
5965

6066
.. tip::
6167

62-
Wordpad, TextEdit, Notepad, and Word are **not** suitable text
63-
editors.
68+
Wordpad, TextEdit, Notepad, and Word are **not** suitable code editors.
6469

6570
What is Python, exactly?
6671
========================
6772

6873
Ok, so python is this thing called a **programming language**. It takes text that
6974
you've written (usually referred to as **code**), turns it into instructions for
7075
your computer, and runs those instructions. We'll be learning how to write code
71-
to do cool and useful stuff. No longer will you be bound to use others'
72-
programs to do things with your computer!
76+
to do cool and useful stuff. No longer will you be bound to use *others'*
77+
programs to do things with your computer - you can make your own!
7378

7479
Practically, Python is just another program on your computer. The first thing to
7580
learn is how to use and interact with it. There are in fact many ways to do this;
7681
the first one to learn is to interact with python's interpreter,
7782
using your **operating system's** (OS) console.
7883

7984
A **console** (or 'terminal', or 'command prompt') is a *textual* way to
80-
interact with your OS, just as the 'desktop', in conjuction with your mouse,
85+
interact with your OS, just as the 'desktop', in conjunction with your mouse,
8186
is the *graphical* way to interact your system.
8287

8388
Opening a console on Mac OS X
@@ -118,39 +123,39 @@ look like::
118123

119124
Window's Command Prompt is not quite as powerful as its counterparts on Linux
120125
and OS X, so you might like to start the Python Interpreter (see just below)
121-
directly, or using the IDLE program that Python comes with. You can find these
122-
in the Start menu.
126+
directly, or using the :program:`IDLE` program that Python comes with.
127+
You can find these in the Start menu.
123128

124129
Using Python
125130
============
126131

127132
The python program that you have installed will by default act as something
128-
called an **interpreter**. An interpreter takes commands and runs them as you
129-
enter them - very handy for trying things out.
133+
called an **interpreter**. An interpreter takes text commands and runs
134+
them as you enter them - very handy for trying things out.
130135

131136
Just type :program:`python` at your console, hit :kbd:`Enter`, and you should
132137
enter Python's Interpreter.
133138

134139
To find out which version of python you're running,
135-
use ``python -V`` to tell you.
140+
instead type ``python -V`` in your console to tell you.
136141

137142
Interacting With Python
138143
-----------------------
139144

140145
After Python opens, it will show you some contextual information similar to this::
141146

142-
Python 3.3.2 (default, May 21 2013, 15:40:45)
143-
[GCC 4.8.0 20130502 (prerelease)] on linux
147+
Python 3.5.0 (default, Sep 20 2015, 11:28:25)
148+
[GCC 5.2.0] on linux
144149
Type "help", "copyright", "credits" or "license" for more information.
145-
>>>
150+
>>>
146151

147152
.. note::
148153

149154
The prompt **>>>** on the last line indicates that you are now in an
150155
interactive Python interpeter session, also called the "Python shell".
151156
**This is different from the normal terminal command prompt!**
152157

153-
You can now enter some python code. Try::
158+
You can now enter some code for python to run. Try::
154159

155160
print("Hello world")
156161

@@ -167,22 +172,50 @@ An extremely useful command is ``help()``, which enters a help functionality
167172
to explore all the stuff python lets you do, right from the interpreter.
168173
Press :kbd:`q` to close the help window and return to the Python prompt.
169174

170-
To leave the interactive shell, press :kbd:`Ctrl-Z` and then
171-
:kbd:`Enter` on Windows, or :kbd:`Ctrl-D` on OS X or Linux. Alternatively,
172-
you could also run the python command ``exit()``!
175+
To leave the interactive shell and go back to the console (the *system* shell),
176+
press :kbd:`Ctrl-Z` and then :kbd:`Enter` on Windows, or :kbd:`Ctrl-D` on
177+
OS X or Linux. Alternatively, you could also run the python command ``exit()``!
178+
179+
180+
Exercise
181+
--------
182+
183+
Just above we demonstrated entering a command to figure out some math. Try
184+
some math commands of your own! What operations does python know? Get it
185+
to tell you what 239 and 588 added together, and then squared is.
186+
187+
.. rst-class:: solution
188+
189+
Solution
190+
--------
191+
192+
Here are some ways you might have got the answer:
193+
194+
195+
>>> 239 + 588
196+
827
197+
>>> 827 * 827
198+
683929
199+
200+
>>> (239 + 588) * (239 + 588)
201+
683929
202+
203+
>>> (239 + 588) ** 2
204+
683929
173205

174206
Running Python files
175207
--------------------
176208

177209
When you have a lot of python code to run, you will want to save it into
178-
a file so, for instance, you can modify small parts of it (fix a bug) and
179-
re-run it without having to repeatedly re-type the rest.
180-
Instead you can save your code to a file and pass a file name to the
181-
:program:`python` executable. It will execute that file instead of launching
182-
the interactive interpreter.
183-
184-
**Let's try that**. Create a file :file:`hello.py` in your current directory
185-
with your favorite text editor and write the print command from above. Now
210+
a file, so for instance, you can modify small parts of it (fix a bug) and
211+
re-run the code without having to repeatedly re-type the rest.
212+
Instead of typing commands in one-by-one you can save your code to a
213+
file and pass the file name to the :program:`python` program.
214+
It will execute that file's code instead of
215+
launching its interactive interpreter.
216+
217+
**Let's try that!** Create a file :file:`hello.py` in your current directory
218+
with your favorite code editor and write the print command from above. Now
186219
save that file. On Linux or OS X, you can also run ``touch hello.py`` to create
187220
an empty file to edit. To run this file with python, it's pretty easy:
188221

@@ -193,7 +226,7 @@ an empty file to edit. To run this file with python, it's pretty easy:
193226
.. note::
194227

195228
Make sure you are at your system command prompt, which will have ``$`` or
196-
``>`` at the end, not at python's (which has ``>>>`` instead)!
229+
``>`` at the end, **not** at python's (which has ``>>>`` instead)!
197230

198231
On Windows you should also be able to double-click the Python file to run it.
199232

@@ -208,8 +241,8 @@ And now we are all set and can get started with turtle!
208241

209242
Not getting "Hello world" but some crazy error about "can't open
210243
file" or "No such file or directory?" Your command line might not be
211-
running in the directory you saved the file in. You can use
212-
the system command line to change your active directory with the
244+
running in the directory that you saved the file in. You can change
245+
the working directory of your current command line with the
213246
:command:`cd` command, which stands for "change directory". On Windows,
214247
you might want something like::
215248

@@ -222,7 +255,7 @@ And now we are all set and can get started with turtle!
222255
$ cd Desktop/Python_Exercises
223256

224257
This changes to the directory Python_Exercises under the Desktop folder
225-
(yours might be somewhere a bit different). If you don't know the location
258+
(yours might be somewhere different). If you don't know the location
226259
of the directory where you saved the file, you can simply drag the
227260
directory to the command line window. If you don't know which
228261
directory your shell is currently running in use :command:`pwd`,
@@ -233,4 +266,4 @@ And now we are all set and can get started with turtle!
233266
When playing around with turtle, avoid naming your file :file:`turtle.py`
234267
--- rather use more appropriate names such as :file:`square.py` or
235268
:file:`rectangle.py`. Otherwise, whenever you refer to ``turtle``, Python
236-
will pick up *your* file instead of the standard turtle.
269+
will pick up *your* file instead of the standard Python turtle module.

en/_sources/simple_drawing.txt

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ Simple drawing with turtle
44
Introduction
55
============
66

7-
Turtle is like a drawing board.
7+
"Turtle" is a python feature like a drawing board, which lets you command
8+
a turtle to draw all over it!
89

9-
It has functions like ``turtle.forward(...)`` and ``turtle.left(...)`` which
10-
can move the turtle around.
10+
You can use functions like ``turtle.forward(...)`` and ``turtle.left(...)``
11+
which can move the turtle around.
1112

1213
Before you can use turtle, you have to import it. We recommend playing around
1314
with it in the interactive interpreter first, as there is an extra bit of work
@@ -69,7 +70,7 @@ So much cuter!
6970
If you put the commands into a file, you might have recognized that the turtle
7071
window vanishes after the turtle finished its movement. (That is because
7172
Python exits when your turtle has finished moving. Since the turtle window
72-
belongs to Python, it terminates as well.) To prevent that, just put
73+
belongs to Python, it goes away as well.) To prevent that, just put
7374
``turtle.exitonclick()`` at the bottom of your file. Now the window stays open
7475
until you click on it::
7576

@@ -86,7 +87,8 @@ until you click on it::
8687
Python is a programming language where horizontal indenting of text is
8788
important. We'll learn all about this in the Functions chapter later on,
8889
but for now just keep in mind that stray spaces or tabs before any line
89-
of Python code can cause an unexpected error.
90+
of Python code can cause an unexpected error. You could even try adding one
91+
to check how python will complain!
9092

9193
Drawing a square
9294
================
@@ -139,8 +141,8 @@ Bonus
139141
If you want to get creative, you can modify your shape with the
140142
``turtle.width(...)`` and ``turtle.color(...)`` functions. How do you
141143
use these functions? Before you can use a function you need to know
142-
its *signature* (for example the number of parameters and what they
143-
mean.) To find this out you can type ``help(turtle.color)`` into the
144+
its *signature* (for example what to put between the parentheses and what those
145+
things mean.) To find this out you can type ``help(turtle.color)`` into the
144146
Python shell. If there is a lot of text, Python will put the help text
145147
into a *pager*, which lets you page up and down. Press the :kbd:`q`
146148
key to exit the pager.
@@ -157,22 +159,26 @@ key to exit the pager.
157159

158160
Another way to find out about functions is to browse the `online documentation`_.
159161

160-
.. _online documentation: http://docs.python.org/library/turtle
162+
.. _online documentation: http://docs.python.org/3/library/turtle
161163

162164

163165
.. caution::
164166

165167
If you misdrew anything, you can tell turtle to erase its drawing board
166-
with the ``turtle.reset()`` directive or undo the most recent step with
168+
with the ``turtle.reset()`` directive, or undo the most recent step with
167169
``turtle.undo()``.
168170

169171
.. tip::
170172

171173
As you might have read in the help, you can modify the color with
172174
:samp:`turtle.color({colorstring})`. These include but are not limited to
173-
"red," "green," and "violet." See the `colours manual`_ for an extensive
175+
"red," "green," and "violet." See this `colours manual`_ for an extensive
174176
list.
175177

178+
If you want to set an RGB value, make sure to run ``turtle.colormode(255)``
179+
first. Then for instance you could run ``turtle.color(215, 100, 170)`` to
180+
set a pink colour.
181+
176182
.. _colours manual: http://www.tcl.tk/man/tcl8.5/TkCmd/colors.htm
177183

178184
Drawing a rectangle
@@ -219,7 +225,8 @@ experiment with the angles between the individual squares.
219225

220226
.. image:: /images/tiltedsquares.png
221227

222-
The picture shows three 20 degree turns. You could try 20, 30 and 40, for example.
228+
The picture shows three 20 degree turns. But you could try 20, 30 and 40 degree
229+
turns, for example.
223230

224231
.. rst-class:: solution
225232

0 commit comments

Comments
 (0)