Skip to content

Commit 553b24d

Browse files
Fix issue 67 (#117)
1 parent 76a513e commit 553b24d

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

‎python-open-source-challenge/issue-67.py‎

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,29 @@ def steadily_improving(students):
1515
improving = []
1616
for student in students:
1717
marks = student["tests"]
18-
# TODO: Check how each pair of successive test marks is compared.
19-
if all(marks[index] > marks[index + 1] for index in range(len(marks) - 1)):
18+
19+
# Check that each test mark is greater than the previous test
20+
if len(marks) >= 2 and all(
21+
marks[index] < marks[index + 1]
22+
for index in range(len(marks) - 1)
23+
):
2024
improving.append(student["name"])
21-
# TODO: Check how students with too few tests are handled.
25+
2226
return improving
2327

28+
2429
def check_solution():
25-
students = [{"name":"A","tests":[50,60,75]},{"name":"B","tests":[70,65,80]},{"name":"C","tests":[90]}]
30+
students = [
31+
{"name": "A", "tests": [50, 60, 75]},
32+
{"name": "B", "tests": [70, 65, 80]},
33+
{"name": "C", "tests": [90]}
34+
]
35+
2636
assert steadily_improving(students) == ["A"]
2737
assert steadily_improving([]) == []
2838

2939
print("All checks passed!")
3040

41+
3142
if __name__ == "__main__":
32-
check_solution()
43+
check_solution()

0 commit comments

Comments
 (0)