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.
making-the-grade
1 parent 36e596b commit 1abb6a6Copy full SHA for 1abb6a6
exercises/concept/making-the-grade/.docs/hints.md
@@ -44,8 +44,8 @@ Also being familiar with the following can help with completing the tasks:
44
45
## 6. A "Perfect" Score
46
47
-- There may be or may not be a student with a score of 100, and you can't return "No perfect score." without checking **all** scores.
48
-- The [`control flow`][control flow] statements `continue` and `break`break may be useful here to move past unwanted values.
+- There may be or may not be a student with a score of 100, and you can't return `[]` without checking **all** scores.
+- The [`control flow`][control flow] statements `continue` and `break` may be useful here to move past unwanted values.
49
50
[list]: https://docs.python.org/3/library/stdtypes.html#list
51
[str]: https://docs.python.org/3/library/stdtypes.html#str
exercises/concept/making-the-grade/.docs/instructions.md
@@ -93,14 +93,14 @@ Create the function `perfect_score()` with parameter `student_info`.
93
`student_info` is a `list` of lists containing the name and score of each student: `[["Charles", 90], ["Tony", 80]]`.
94
The function should `return` _the first_ `[<name>, <score>]` pair of the student who scored 100 on the exam.
95
96
- If no 100 scores are found in `student_info`, the string "No perfect score." should be returned.
+ If no 100 scores are found in `student_info`, an empty list `[]` should be returned.
97
98
```python
99
>>> perfect_score(student_info=[["Charles", 90], ["Tony", 80], ["Alex", 100]])
100
["Alex", 100]
101
102
>>> perfect_score(student_info=[["Charles", 90], ["Tony", 80]])
103
-"No perfect score."
+[]
104
```
105
106
[round]: https://docs.python.org/3/library/functions.html#round
exercises/concept/making-the-grade/.meta/exemplar.py
@@ -69,10 +69,10 @@ def student_ranking(student_scores, student_names):
69
def perfect_score(student_info):
70
"""
71
:param student_info: list of [<student name>, <score>] lists
72
- :return: First [<student name>, 100] found OR "No perfect score."
+ :return: first `[<student name>, 100]` or `[]` if no student score of 100 is found.
73
74
75
- result = "No perfect score."
+ result = []
76
77
for item in student_info:
78
if item[1] == 100:
exercises/concept/making-the-grade/loops.py
@@ -48,6 +48,6 @@ def student_ranking(student_scores, student_names):
52
53
pass
exercises/concept/making-the-grade/loops_test.py
@@ -87,11 +87,11 @@ def test_student_ranking(self):
87
def test_perfect_score(self):
88
data = [
89
([['Joci', 100], ['Vlad', 100], ['Raiana', 100], ['Alessandro', 100]], ['Joci', 100]),
90
- ([['Jill', 30], ['Paul', 73], ], 'No perfect score.'),
91
- ([], 'No perfect score.'),
+ ([['Jill', 30], ['Paul', 73], ], []),
+ ([], []),
92
(
[['Rui', 60], ['Joci', 58], ['Sara', 91], ['Kora', 93], ['Alex', 42],
- ['Jan', 81], ['Lilliana', 40], ['John', 60], ['Bern', 28], ['Vlad', 55]], 'No perfect score.'),
+ ['Jan', 81], ['Lilliana', 40], ['John', 60], ['Bern', 28], ['Vlad', 55]], []),
[['Yoshi', 52], ['Jan', 86], ['Raiana', 100], ['Betty', 60],
['Joci', 100], ['Kora', 81], ['Bern', 41], ['Rose', 94]], ['Raiana', 100])]
0 commit comments