diff --git a/python-open-source-challenge/issue-17.py b/python-open-source-challenge/issue-17.py index 73c6048..f3128ff 100644 --- a/python-open-source-challenge/issue-17.py +++ b/python-open-source-challenge/issue-17.py @@ -19,7 +19,7 @@ def summarize_orders(orders): quantity = order["quantity"] price = order["price"] # TODO: Check how each line contributes to the bill. - total += price + total += price * quantity # TODO: Check how repeated item orders are combined. quantities[item] = quantities.get(item, 0) + quantity # TODO: Check how an empty order list is handled. diff --git a/python-open-source-challenge/issue-32.py b/python-open-source-challenge/issue-32.py index 8b4646f..f492362 100644 --- a/python-open-source-challenge/issue-32.py +++ b/python-open-source-challenge/issue-32.py @@ -16,11 +16,11 @@ def subject_extremes(students): for student in students: for subject, mark in student["marks"].items(): # TODO: Check how both ends of the subject range are initialized. - bounds = subjects.setdefault(subject, [0, mark]) + bounds = subjects.setdefault(subject, [mark, mark]) # TODO: Check how a new high mark updates the range. - bounds[0] = min(bounds[0], mark) + bounds[0] = max(bounds[0], mark) # TODO: Check how a new low mark updates the range. - bounds[1] = max(bounds[1], mark) + bounds[1] = min(bounds[1], mark) # TODO: Check the order and meaning of each returned bound. return subjects diff --git a/python-open-source-challenge/issue-57.py b/python-open-source-challenge/issue-57.py index 3a7a355..fb0a1a7 100644 --- a/python-open-source-challenge/issue-57.py +++ b/python-open-source-challenge/issue-57.py @@ -20,7 +20,7 @@ def mobile_charges(usages): # TODO: Check the data charge included in each record. cost += usage["data_gb"] * 2 # TODO: Check how multiple records for one user are accumulated. - charges[user] = charges.get(user, 0) - cost + charges[user] = charges.get(user, 0) + cost # TODO: Check that users with no usage aren't fabricated. return charges diff --git a/python-open-source-challenge/issue-74.py b/python-open-source-challenge/issue-74.py index a70948d..676472f 100644 --- a/python-open-source-challenge/issue-74.py +++ b/python-open-source-challenge/issue-74.py @@ -23,7 +23,7 @@ def attendance_report(records, minimum_percent): present[student] = present.get(student, 0) + 1 percentages = {student: present.get(student, 0) / total * 100 for student, total in counted.items()} # TODO: Check which students fall below the requested threshold. - below = [student for student, percent in percentages.items() if percent > minimum_percent] + below = [student for student, percent in percentages.items() if percent < minimum_percent] # TODO: Check that percentages for all students are returned. return percentages, below