Skip to content

Commit c6f3ff7

Browse files
committed
Update project code
Add pyproject.toml, Add named scripts, Rename script, Remove initial versions of scripts
1 parent 3200a38 commit c6f3ff7

File tree

7 files changed

+35
-29
lines changed

7 files changed

+35
-29
lines changed
File renamed without changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
for number in range(2):
2+
try:
3+
print(f"Iteration {number}: start of try block")
4+
5+
if number == 1:
6+
print(f" Executing `continue` in iteration {number}...")
7+
continue
8+
9+
print(f" Normal flow in iteration {number}...")
10+
11+
except Exception as e:
12+
print(f"Iteration {number}: Exception: {e}")
13+
14+
finally:
15+
print(f"Iteration {number}: finally block")
16+
17+
print(f"Iteration {number}: rest of loop body", end="\n\n")

skip-ahead-with-continue/example1.py

Lines changed: 0 additions & 6 deletions
This file was deleted.

skip-ahead-with-continue/example1_continued.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

skip-ahead-with-continue/example1_instaviz.py

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[project]
2+
name = "skip-ahead-with-continue"
3+
version = "0.1.0"
4+
description = "Code for the Real Python tutorial on Python's `continue` keyword"
5+
readme = "README.md"
6+
requires-python = ">=3.8"
7+
dependencies = ["instaviz"]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
print("Enter one whole number per input.")
2+
print("Type 0 to stop and display their sum:")
3+
4+
total = 0
5+
6+
while (user_int := int(input("+ "))) != 0:
7+
if user_int < 0:
8+
continue
9+
total += user_int
10+
11+
print(f"{total=}")

0 commit comments

Comments
 (0)