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
Copy file name to clipboardExpand all lines: core/chapters/c05_if_statements.py
+6-4Lines changed: 6 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -210,6 +210,8 @@ def program(self):
210
210
211
211
212
212
classUnderstandingProgramsWithSnoop(Page):
213
+
title="Understanding Programs With `snoop`"
214
+
213
215
classprint_tail(print_tail_base):
214
216
"""
215
217
Run this program:
@@ -228,15 +230,15 @@ class print_tail(print_tail_base):
228
230
classprint_tail_snoop(print_tail_base):
229
231
"""
230
232
Programs are starting to get complicated!
231
-
It's time to introduce a new tool to help you understand programs. Click the'Snoop' button to run the same program while also showing what's happening.
233
+
It's time to introduce a new tool to help you understand programs. Click the`snoop` button to run the same program while also showing what's happening.
232
234
"""
233
235
234
236
program_in_text=False
235
237
expected_code_source="snoop"
236
238
237
239
classprint_first_character(ExerciseStep):
238
240
"""
239
-
Tada! Scroll to the top of the terminal and let's walk through what snoop is showing you.
241
+
Tada! Scroll to the top of the terminal and let's walk through what`snoop` is showing you.
240
242
It starts out very straightforward:
241
243
242
244
1 | sentence = 'Hello World'
@@ -248,9 +250,9 @@ class print_first_character(ExerciseStep):
248
250
The first lines are simply showing you the lines of the program that the computer ran.
249
251
On the left is the line number as seen in the editor.
250
252
251
-
Running `for char in sentence:` assigns a value to the variable `char`, so snoop shows you that value.
253
+
Running `for char in sentence:` assigns a value to the variable `char`, so`snoop` shows you that value.
252
254
Lines starting with `......` indicate a new variable or a change in the value of an existing variable.
253
-
Such lines will not be shown when they're redundant, which is why the snoop output doesn't start like this:
255
+
Such lines will not be shown when they're redundant, which is why the`snoop` output doesn't start like this: