From ccd1b813a4a50da2f542f3c409ab9b3d5fcf4f58 Mon Sep 17 00:00:00 2001 From: "Cal.W" <20716204+calw20@users.noreply.github.com> Date: Sun, 28 Jun 2020 21:48:12 +1000 Subject: [PATCH] Removed misc print statements --- bankView.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/bankView.py b/bankView.py index 033fb0a..6829107 100644 --- a/bankView.py +++ b/bankView.py @@ -127,17 +127,10 @@ def calculateStats(transactions, yearRangeVal=None, monthRangeVal=None, otherFel if isinstance(monthRangeVal, list) or isinstance(monthRangeVal, tuple): monthRange = lambda x: x[1].month in monthRangeVal if isinstance(monthRangeVal, int) or isinstance(monthRangeVal, float): monthRange = lambda x: x[1].month == int(monthRangeVal) - if not isinstance(yearRangeVal, type(monthRangeVal)): otherFelid = lambda x: True + if not isinstance(yearRangeVal, type(monthRange)): otherFelid = lambda x: True periodTransactions = [x for x in transactions if yearRange(x) and monthRange(x) and otherFelid(x)] - print(periodTransactions) - print("*"*70) periodTransactions = sorted(periodTransactions, reverse = True, key = lambda x: x[1]) - - print(periodTransactions) - - input("$"*70) - stats = { "credits" : round(sum([abs(x[2]) for x in periodTransactions if x[2] > 0]), 2) if len([abs(x[2]) for x in periodTransactions if x[2] > 0]) > 0 else float(0), @@ -154,6 +147,7 @@ def calculateStats(transactions, yearRangeVal=None, monthRangeVal=None, otherFel return stats + def foo(transactions): years = [] for trans in transactions: @@ -166,8 +160,8 @@ def foo(transactions): if __name__ == "__main__": trans = loadTransactionData() - y = lambda x: x[-2] == TRANSACTION_TYPES[0] - print(calculateStats(trans, otherFelid=y)) + stats = calculateStats(trans) + print(stats['averageBalance']) #calculateStats(trans)