-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcashflow.py
More file actions
33 lines (25 loc) · 785 Bytes
/
cashflow.py
File metadata and controls
33 lines (25 loc) · 785 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class CashFlow :
def __init__(self) :
self.name = "Jou"
self.assets = 10000
self.cashflow = [10000,]
def set_name(self, name:str) :
self.name = name
def set_assets(self, assets:int) :
self.assets = assets
def income(self, income) :
self.assets += income
def expanse(self, expanse) :
if expanse > self.assets :
print("Can't afford ")
else :
self.cashflow.append(-1 * expanse)
self.assets -= expanse
def print_cashflow(self) :
for i in self.cashflow :
print(i)
if __name__ == "__main__" :
c = CashFlow()
c.print_cashflow()
c.expanse(500)
c.print_cashflow()