Skip to content

Commit 1abb6a6

Browse files
pranasziaukasBethanyG
authored andcommitted
Adjust making-the-grade to return list type
1 parent 36e596b commit 1abb6a6

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

exercises/concept/making-the-grade/.docs/hints.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ Also being familiar with the following can help with completing the tasks:
4444

4545
## 6. A "Perfect" Score
4646

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.
47+
- There may be or may not be a student with a score of 100, and you can't return `[]` without checking **all** scores.
48+
- The [`control flow`][control flow] statements `continue` and `break` may be useful here to move past unwanted values.
4949

5050
[list]: https://docs.python.org/3/library/stdtypes.html#list
5151
[str]: https://docs.python.org/3/library/stdtypes.html#str

exercises/concept/making-the-grade/.docs/instructions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,14 @@ Create the function `perfect_score()` with parameter `student_info`.
9393
`student_info` is a `list` of lists containing the name and score of each student: `[["Charles", 90], ["Tony", 80]]`.
9494
The function should `return` _the first_ `[<name>, <score>]` pair of the student who scored 100 on the exam.
9595

96-
If no 100 scores are found in `student_info`, the string "No perfect score." should be returned.
96+
If no 100 scores are found in `student_info`, an empty list `[]` should be returned.
9797

9898
```python
9999
>>> perfect_score(student_info=[["Charles", 90], ["Tony", 80], ["Alex", 100]])
100100
["Alex", 100]
101101

102102
>>> perfect_score(student_info=[["Charles", 90], ["Tony", 80]])
103-
"No perfect score."
103+
[]
104104
```
105105

106106
[round]: https://docs.python.org/3/library/functions.html#round

exercises/concept/making-the-grade/.meta/exemplar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ def student_ranking(student_scores, student_names):
6969
def perfect_score(student_info):
7070
"""
7171
:param student_info: list of [<student name>, <score>] lists
72-
:return: First [<student name>, 100] found OR "No perfect score."
72+
:return: first `[<student name>, 100]` or `[]` if no student score of 100 is found.
7373
"""
7474

75-
result = "No perfect score."
75+
result = []
7676

7777
for item in student_info:
7878
if item[1] == 100:

exercises/concept/making-the-grade/loops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ def student_ranking(student_scores, student_names):
4848
def perfect_score(student_info):
4949
"""
5050
:param student_info: list of [<student name>, <score>] lists
51-
:return: First [<student name>, 100] found OR "No perfect score."
51+
:return: first `[<student name>, 100]` or `[]` if no student score of 100 is found.
5252
"""
5353
pass

exercises/concept/making-the-grade/loops_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ def test_student_ranking(self):
8787
def test_perfect_score(self):
8888
data = [
8989
([['Joci', 100], ['Vlad', 100], ['Raiana', 100], ['Alessandro', 100]], ['Joci', 100]),
90-
([['Jill', 30], ['Paul', 73], ], 'No perfect score.'),
91-
([], 'No perfect score.'),
90+
([['Jill', 30], ['Paul', 73], ], []),
91+
([], []),
9292
(
9393
[['Rui', 60], ['Joci', 58], ['Sara', 91], ['Kora', 93], ['Alex', 42],
94-
['Jan', 81], ['Lilliana', 40], ['John', 60], ['Bern', 28], ['Vlad', 55]], 'No perfect score.'),
94+
['Jan', 81], ['Lilliana', 40], ['John', 60], ['Bern', 28], ['Vlad', 55]], []),
9595
(
9696
[['Yoshi', 52], ['Jan', 86], ['Raiana', 100], ['Betty', 60],
9797
['Joci', 100], ['Kora', 81], ['Bern', 41], ['Rose', 94]], ['Raiana', 100])]

0 commit comments

Comments
 (0)