Skip to content

Commit

Permalink
Initial amount 0 was problematic, needed to explicitly say "not None"
Browse files Browse the repository at this point in the history
  • Loading branch information
Robinsane committed Jul 26, 2022
1 parent e2c4008 commit 47c7fa1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compound_interest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!")
Expand Down

0 comments on commit 47c7fa1

Please sign in to comment.