Skip to content

Commit

Permalink
add else clause to first iteration example
Browse files Browse the repository at this point in the history
The comment makes more sense this way and students
learn about this lesser known feature of Python
  • Loading branch information
Deric-W committed Feb 25, 2022
1 parent fc7d3ac commit 92bd7f5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions latex/slides/resources/03_builtins/iterate.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
for i in [1,2,3]:
if i > 9:
break
# code
else:
pass
# wenn kein break vorkommt
# verlässt die Schleife
else:
pass
# wenn kein break vorkommt

for i in (1,2,3):
# code
Expand Down
8 changes: 4 additions & 4 deletions md/03_builtins.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ s2.add(5) # ==> AttributeError: 'frozenset' object has no attribute 'add'
for i in [1,2,3]:
if i > 9:
break
# code
else:
pass
# wenn kein break vorkommt
# verlässt die Schleife
else:
pass
# wenn kein break vorkommt

for i in (1,2,3):
# code
Expand Down

0 comments on commit 92bd7f5

Please sign in to comment.