We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 30b6d8c commit 763c726Copy full SHA for 763c726
1 file changed
python-break/while_loop_print_test_scores_example.py
@@ -0,0 +1,10 @@
1
+# Use case 2: Print out the score of the first five tests (while loop)
2
+scores = [90, 30, 50]
3
+i = 0
4
+
5
+while i < 5:
6
+ if i > len(scores) - 1:
7
+ # If there are less than 5 scores, break out of the loop when all scores are printed
8
+ break
9
+ print("Score: " + str(scores[i]))
10
+ i += 1
0 commit comments