Pass or Fail
Python
25 pts
Pass or Fail
The set marks holds the different marks in a class test. The pass mark is 50.
- Create two empty sets:
passedandfailed. - Loop through
marks. Add each mark of 50 or more topassedand every other mark tofailed. - Print
sorted(passed), thensorted(failed). - Print a summary line as shown, using
len().
Expected output:
[52, 66, 78, 85, 90] [30, 45] Passed: 5 of 7
Checklist
- Keep
marksunchanged and create two empty sets:passedandfailed. - Loop through
marksand add each mark to the right set (50 or more passes). - Print both sorted sets and the summary line.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
