Skip to content

Commit 6d9e6fc

Browse files
authored
Changed directory name to match article slug, and updated code samples
1 parent b41931b commit 6d9e6fc

File tree

8 files changed

+13
-17
lines changed

8 files changed

+13
-17
lines changed

python-break/README.md renamed to how-to-exit-loops-early-with-python-break-keyword/README.md

File renamed without changes.

python-break/break_statement_introduction.py renamed to how-to-exit-loops-early-with-python-break-keyword/break_statement_introduction.py

File renamed without changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
for index in range(6):
2+
if index % 2 == 0:
3+
continue
4+
print(index)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
scores = [90, 30, 50, 70, 85, 35]
2+
3+
num_failed_scores = 0
4+
failed_score = 60
5+
for score in scores:
6+
if score < failed_score:
7+
num_failed_scores += 1
8+
9+
print(f"Number of failed tests: {num_failed_scores}")

python-break/for_loop_test_scores_example.py renamed to how-to-exit-loops-early-with-python-break-keyword/for_loop_test_scores_example_with_tutor_rec.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Use case 1: If the student fails 2 or more tests,
2-
# the student must go to tutoring (for-loop)
31
scores = [90, 30, 50, 70, 85, 35]
42

53
num_failed_scores = 0

python-break/nested_loop_number_of_failed_students_example.py renamed to how-to-exit-loops-early-with-python-break-keyword/nested_loop_number_of_failed_students_example.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Use case 4: Check to see how many students have failed a test (nested loop)
21
scores = [[90, 30, 80, 100], [100, 80, 95, 87], [75, 84, 77, 90]]
32

43
failed_score = 60

python-break/user_input_example.py renamed to how-to-exit-loops-early-with-python-break-keyword/user_input_example.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Use case 3: Getting user input
2-
3-
# Import the random module for generating random numbers
41
import random
52

63
guesses_left = 4

python-break/while_loop_print_test_scores_example.py

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

0 commit comments

Comments
 (0)