Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions python-open-source-challenge/issue-67.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,29 @@ def steadily_improving(students):
improving = []
for student in students:
marks = student["tests"]
# TODO: Check how each pair of successive test marks is compared.
if all(marks[index] > marks[index + 1] for index in range(len(marks) - 1)):

# Check that each test mark is greater than the previous test
if len(marks) >= 2 and all(
marks[index] < marks[index + 1]
for index in range(len(marks) - 1)
):
improving.append(student["name"])
# TODO: Check how students with too few tests are handled.

return improving


def check_solution():
students = [{"name":"A","tests":[50,60,75]},{"name":"B","tests":[70,65,80]},{"name":"C","tests":[90]}]
students = [
{"name": "A", "tests": [50, 60, 75]},
{"name": "B", "tests": [70, 65, 80]},
{"name": "C", "tests": [90]}
]

assert steadily_improving(students) == ["A"]
assert steadily_improving([]) == []

print("All checks passed!")


if __name__ == "__main__":
check_solution()
check_solution()
Loading