From 47c7fa15b0c9de088b61e0bedf54e4c13b9fec9f Mon Sep 17 00:00:00 2001 From: rboone Date: Tue, 26 Jul 2022 17:15:31 +0200 Subject: [PATCH] Initial amount 0 was problematic, needed to explicitly say "not None" --- compound_interest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compound_interest.py b/compound_interest.py index e5a7cc4..48bced2 100644 --- a/compound_interest.py +++ b/compound_interest.py @@ -28,7 +28,7 @@ def __init__(self, parent, annual_return, months, monthly_deposit=0, initial_amo for m in range(months): temp_result = (temp_result + monthly_deposit) * monthly_return self.result = int(temp_result) - elif initial_amount: # First CompoundResult in a chain + elif initial_amount is not None: # First CompoundResult in a chain self.result = initial_amount else: raise Exception("CompoundResult constructor without a parent and no initial_amount was given!")