We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 38a59b7 commit f4d14afCopy full SHA for f4d14af
python-break/nested_loop_number_of_failed_students_example.py
@@ -0,0 +1,15 @@
1
+# Use case 4: Check to see how many students have failed a test (nested loop)
2
+scores = [
3
+ [90, 30, 80, 100],
4
+ [100, 80, 95, 87],
5
+ [75, 84, 77, 90]
6
+]
7
+
8
+failed_score = 60
9
+num_failed_students = 0
10
+for score_set in scores:
11
+ for score in score_set:
12
+ if score < failed_score:
13
+ num_failed_students += 1
14
+ break
15
+print("Number of students who failed a test: " + str(num_failed_students))
0 commit comments