You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 14799cb
Browse filesBrowse the repository at this point in the historyBrowse files
"Conditional loops are way to repeat something while a certain condition is "
@@ -28,75 +38,90 @@ msgid ""
28
38
"defined with the ``while`` statement::"
29
39
msgstr""
30
40
41
+
# dca5de2f82e543c4a48463876e388415
31
42
#:../../../source/conditional_loops.rst:23
32
43
msgid"We call this part of the code the 'conditional': ``'.' not in word``"
33
44
msgstr""
34
45
46
+
# 9d1aa6649ba94e21908cff558d8e8826
35
47
#:../../../source/conditional_loops.rst:25
36
48
msgid""
37
49
"Whether the conditional return True or not determines whether the code "
38
50
"inside the ``while`` loop runs."
39
51
msgstr""
40
52
53
+
# 7fc839b4812d49c087116e5c082b0654
41
54
#:../../../source/conditional_loops.rst:28
42
55
msgid""
43
56
"Read the code above, and see if you can summarise in your head what it what "
44
57
"it do (what its final output will be)."
45
58
msgstr""
46
59
60
+
# 18c22a5fe65440de8c2100ef541567b0
47
61
#:../../../source/conditional_loops.rst:31
48
62
msgid""
49
63
"Then copy it into a file, say :file:`sentence.py` and run it - see exactly "
50
64
"what it does. Does that match up with what you thought?"
51
65
msgstr""
52
66
67
+
# 400050782b514b07b884a224a79f4915
53
68
#:../../../source/conditional_loops.rst:36
54
69
msgid""
55
70
"If you are using Python 2, you will need to replace ``input`` with "
56
71
"``raw_input`` to run the program correctly."
57
-
msgstr""
72
+
msgstr"Если ты используешь Python 2, замени ``input`` на ``raw_input`` для корректной работы программы."
58
73
74
+
# 893ffd73db564e45bf4edc62de0c4aec
59
75
#:../../../source/conditional_loops.rst:40
60
76
msgid"Turtle prison"
61
-
msgstr""
77
+
msgstr"Тюрьма для черепашки"
62
78
79
+
# 45292113e45d41e7b1b92ccf9d813a8b
80
+
# 324bbaf285c5445f846e9ad7f3d79213
63
81
#:../../../source/conditional_loops.rst:43
64
82
#:../../../source/conditional_loops.rst:87
65
83
msgid"Exercise"
66
-
msgstr""
84
+
msgstr"Упражнение"
67
85
86
+
# a2660c48dad44766bde0bf90b2ad0528
68
87
#:../../../source/conditional_loops.rst:45
69
88
msgid""
70
89
"The turtle has been up to its usual tricks again, robbing liqour stores and "
71
90
"building up huge gambling debts. It's time for turtle to be put into a cell "
72
91
"that it can't get out of."
73
92
msgstr""
74
93
94
+
# c903bbaa30ea41c99d255de554d25a44
75
95
#:../../../source/conditional_loops.rst:49
76
96
msgid""
77
97
"Let's make a new version of ``forward()``. One that will turn the turtle "
78
98
"around if it tries to go further than 100 from the origin. We'll need a "
79
99
"``while`` loop, and some new turtle functions:"
80
-
msgstr""
100
+
msgstr"Давайте сделаем новую версию ``forward()``, которая будет поворачивать черепашку, если она слишком далеко (более, чем на 100) отойдёт от начала координатной сетки. . Нам понадобится цикл ``while`` и несколько новых функций для черепашки:"
81
101
102
+
# 3ce77ae318ca4616805a1fe13f9c94f0
82
103
#:../../../source/conditional_loops.rst:53
83
104
msgid"``turtle.distance(0,0)`` - Distance of the turtle from the origin"
84
-
msgstr""
105
+
msgstr"``turtle.distance(0,0)`` - Расстояние до черепашки от начала координат"
85
106
107
+
# 2743f0601d844fd5827dc8ca59a5161b
86
108
#:../../../source/conditional_loops.rst:54
87
109
msgid"``turtle.towards(0,0)`` - The angle to get back to origin"
88
-
msgstr""
110
+
msgstr"``turtle.towards(0,0)`` - Градусная мера угла для возвращения к началу координат"
89
111
112
+
# 735068e95dbb4feb83bc42382501dba0
90
113
#:../../../source/conditional_loops.rst:55
91
114
msgid"``turtle.setheading(angle)`` - Directly sets the turtle direction"
92
-
msgstr""
115
+
msgstr"``turtle.setheading(angle)`` - Ручная установка направления черепашки"
93
116
117
+
# 0122ec4586504984bd958b7f612c62f6
94
118
#:../../../source/conditional_loops.rst:57
95
119
msgid""
96
120
"You could try playing with a turtle in the interpreter and using these "
97
121
"functions to check exactly what they do, if you like."
98
122
msgstr""
99
123
124
+
# 0e6c0ed6971b4e538b809f9a0cd1f136
100
125
#:../../../source/conditional_loops.rst:60
101
126
msgid""
102
127
"Now you will need to implement the prison logic using these turtle "
@@ -105,22 +130,27 @@ msgid ""
105
130
" or another student."
106
131
msgstr""
107
132
133
+
# 1b49d73c3a5e4021ac2fe477151ecc2f
134
+
# 14cab36de06d4023b20c5be256604d50
108
135
#:../../../source/conditional_loops.rst:66
109
136
#:../../../source/conditional_loops.rst:104
110
137
msgid"Solution"
111
-
msgstr""
138
+
msgstr"Решение"
112
139
140
+
# 352a42136ca6400ab20cf89a1ab398b3
113
141
#:../../../source/conditional_loops.rst:80
114
142
msgid"Draw a spiral"
115
-
msgstr""
143
+
msgstr"Рисуем спираль"
116
144
145
+
# 6aeef203d95c4a34bd5bd692b99ebe55
117
146
#:../../../source/conditional_loops.rst:82
118
147
msgid""
119
148
"Loops can be interrupted with the ``break`` statement. This is especially "
120
149
"useful if you write an *infinite loop*, which is a loop where the "
121
150
"conditional is always **True**."
122
-
msgstr""
151
+
msgstr"Циклы могут быть прерваны командой ``break``. Она особенно полезна, если ты пишешь *бесконечный цикл*, т.е. цикл, условие которого всегда истинно."
123
152
153
+
# 217e80c3d8024535a12d1b844ab5475a
124
154
#:../../../source/conditional_loops.rst:89
125
155
msgid""
126
156
"Write a ``while`` loop with a condition that is always **True** to draw a "
@@ -129,23 +159,27 @@ msgid ""
129
159
"distance to the point defined by the coordinates ``x`` and ``y``."
130
160
msgstr""
131
161
162
+
# bd8e43cfe2964a199f111a74393dff96
132
163
#:../../../source/conditional_loops.rst:94
133
164
msgid""
134
165
"To do this you will need the ``turtle.xcor()`` and ``turtle.ycor()`` "
135
166
"functions, which return the position of the turtle in X and Y axes "
136
167
"respectively."
137
168
msgstr""
138
169
170
+
# 88a12b054e8245ca96d6e8180a7d0212
139
171
#:../../../source/conditional_loops.rst:100
140
172
msgid""
141
173
"To draw a spiral, the turtle has to rotate by a constant value and move "
142
174
"forward by an increasing value."
143
-
msgstr""
175
+
msgstr"Чтобы нарисовать спираль, черепашка должна поворачиваться на неизменяемую величину и двигаться вперёд на постоянно увеличивающееся расстояние"
144
176
177
+
# 8030819ae52e44e3a12fc6b6b071eb14
145
178
#:../../../source/conditional_loops.rst:120
146
179
msgid"Bonus"
147
-
msgstr""
180
+
msgstr"Дополнительно"
148
181
182
+
# 5d9767087dc74306a1046a3c8d5b7936
149
183
#:../../../source/conditional_loops.rst:122
150
184
msgid""
151
185
"Can you make a conditional for this loop, so you don't need the infinite "
"So far we have accomplished predefined tasks, but in all honesty we were "
@@ -29,83 +39,99 @@ msgid ""
29
39
"way if not. They are also commonly called by programmers *if statements*."
30
40
msgstr""
31
41
42
+
# 6ab33a31c9d445248ff5b58f0cf4f72d
32
43
#:../../../source/conditionals.rst:15
33
44
msgid""
34
45
"To know if a condition is *True* of *False*, we need a new type of data: the"
35
46
" booleans. They allow logical operations. A logic statement or operation can"
36
47
" be evaluated to be *True* or *False*. Our conditional statement can then be"
37
48
" understood like this:"
38
-
msgstr""
49
+
msgstr"Чтобы узнать, *Истинно* или *Ложно* значение, нужен новый тип информации: логический, описываемый логическими операторами. Любое логическое значение или логическая операция могут быть оценены как \"Истина\" или \"Ложь\". Условные выражения следует понимать так:"
39
50
51
+
# df9289eacd1641e2a43ea2a25534e5c0
40
52
#:../../../source/conditionals.rst:20
41
53
msgid"**if** *(a condition evaluates to True)*:"
42
-
msgstr""
54
+
msgstr"**if** *(условие истинно)*:"
43
55
56
+
# 0ae1d5541cf74fbeabed31852dd3ab27
44
57
#:../../../source/conditionals.rst:21
45
58
msgid"*then do these things only for 'True'*"
46
-
msgstr""
59
+
msgstr"*делать это*"
47
60
61
+
# 3093566db649459bb19ecc1750cd6821
48
62
#:../../../source/conditionals.rst:23
49
63
msgid"**else**:"
50
-
msgstr""
64
+
msgstr"**else**:"
51
65
66
+
# 2d0805b64cc546dea95078db5e86937e
52
67
#:../../../source/conditionals.rst:23
53
68
msgid"*otherwise do these things only for 'False'*."
54
-
msgstr""
69
+
msgstr"*в противном случае делать это*"
55
70
71
+
# d73d211ecfcb43209a8729611cbd3add
56
72
#:../../../source/conditionals.rst:25
57
73
msgid""
58
74
"The condition can be anything that evaluates as *True* or *False*. "
59
75
"Comparisons always return *True* or *False*, for example ``==`` (equal to), "
60
76
"``>`` (greater than), ``<`` (less than.)"
61
77
msgstr""
62
78
79
+
# 77c7b5b62fab41a580bbf8b711d4a2a0
63
80
#:../../../source/conditionals.rst:29
64
81
msgid""
65
82
"The **else** part is optional. If you leave it off, nothing will happen if "
66
83
"the conditional evaluates to 'False'."
67
-
msgstr""
84
+
msgstr"Часть **else** необязательна. Если убрать её, при ложном значении ничего не произойдёт."
68
85
86
+
# 15270b28c4db44858ad24d8a5a1a94f5
69
87
#:../../../source/conditionals.rst:34
70
88
msgid"Examples"
71
-
msgstr""
89
+
msgstr"Примеры"
72
90
91
+
# 64365e8b331842cb82b2865a646b6e14
73
92
#:../../../source/conditionals.rst:36
74
93
msgid""
75
94
"Here are some examples. You may want to read them over line-by-line and see "
76
95
"what you think they do, or run them to be certain::"
77
-
msgstr""
96
+
msgstr"Немного примеров. Можешь просмотреть их построчно и попытаться понять, что они делают (или запустить, чтобы быть уверенным)::"
78
97
98
+
# b5e742cfef1b46258ffe386e70d3d374
79
99
#:../../../source/conditionals.rst:54
80
100
msgid"Giving Directions"
81
101
msgstr""
82
102
103
+
# d2308a4e4a234d5da113610124a1f0d0
83
104
#:../../../source/conditionals.rst:56
84
105
msgid""
85
106
"Python turtles can be very good at following instructions. Let's use the "
86
107
"``input()`` function to ask the user for a direction to move the turtle. To "
87
108
"keep things easy we will only accept two instructions: \"left\" and "
88
109
"\"right\"."
89
-
msgstr""
110
+
msgstr"Python-черепашка хорошо работает с последовательными указаниями. Давайте с помощью функции ``input()`` будем принимать команды от пользователя, которые указывают направление движения черепашки. Чтобы не усложнять программу, предусмотрим только 2 инструкции: \"налево\" и \"направо\"."
90
111
112
+
# a8865376d13a4ac0876033a9e6899611
91
113
#:../../../source/conditionals.rst:63
92
114
msgid"Using Python 2? The ``input()`` function is called ``raw_input()``."
93
-
msgstr""
115
+
msgstr"Используешь Python 2? Функция ``input()`` называется ``raw_input()``."
94
116
117
+
# 337298bbc33a4e18a869f8788a145bfe
95
118
#:../../../source/conditionals.rst:65
96
119
msgid"It's much easier to define this as a function, like so::"
97
-
msgstr""
120
+
msgstr"Намного проще выделить это в функцию, вот так::"
98
121
122
+
# 03c556dba3c54816aab05ef1e9d597d7
99
123
#:../../../source/conditionals.rst:76
100
124
msgid""
101
125
"Now whenever you use ``move()`` you are prompted to choose ``left`` or "
102
126
"``right``."
103
-
msgstr""
127
+
msgstr"Теперь, используя ``move()``, ты можешь выбрать, в какую сторону двигаться: влево (``left``) или вправо (``right``)."
104
128
129
+
# 93a25c13d04147449bec02723b02181b
105
130
#:../../../source/conditionals.rst:81
106
131
msgid"\"data munging\""
107
132
msgstr""
108
133
134
+
# f783026a116745d48f6abd395d97c2ce
109
135
#:../../../source/conditionals.rst:83
110
136
msgid""
111
137
"In this program, the turtle will only respond to exactly ``left`` or "
@@ -116,21 +142,24 @@ msgid ""
116
142
"everything lower-case."
117
143
msgstr""
118
144
145
+
# 7809bb0040d246f9b697fca88fca775c
119
146
#:../../../source/conditionals.rst:90
120
147
msgid""
121
148
"Here are some examples to print out the effects of ``.strip()`` and "
122
149
"``.lower()``::"
123
-
msgstr""
150
+
msgstr"Немного примеров, демонстрирующих работу ``.strip()`` и ``.lower()``::"
124
151
152
+
# 2609be470843427a931b85efbe540dab
125
153
#:../../../source/conditionals.rst:99
126
154
msgid""
127
155
"Try adding ``direction = direction.strip().lower()`` to the ``move()`` "
128
156
"function, to see the effect. We often call this kind of code \"data "
129
157
"munging\", and it is very common."
130
158
msgstr""
131
159
160
+
# d26798a24e044d399280f7d78a8becea
132
161
#:../../../source/conditionals.rst:103
133
162
msgid""
134
163
"Can you add some extra input choices to make the turtle draw other things? "
135
164
"How about ``hexagon``?"
136
-
msgstr""
165
+
msgstr"Можешь ли ты добавить дополнительные варианты движения, чтобы черепашка рисовала другие фигуры? Как насчёт шестиугольника?"
0 commit comments