-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbank_account.py
38 lines (31 loc) · 933 Bytes
/
bank_account.py
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
34
35
36
37
38
class Acount():
maximum_balance = 300
def __init__(self, owner, balance):
self.owner = owner
self.balance = balance
def deposit(self, amount):
print(self.balance + amount)
print(self.maximum_balance)
if (self.balance + amount) > self.maximum_balance:
print('You reached the maximum deposit')
else:
self.balance = self.balance + amount
return self.balance
def withdraw(self, amount):
if self.balance >= amount:
self.balance = self.balance - amount
else:
print('You don not have balance')
return self.balance
def __str__(self):
return f'Owner: {self.owner} \nBalance: {self.balance}'
acount = Acount('Jose', 100)
print(acount.deposit(100))
print(acount.deposit(100))
print(str(acount))
print(acount.deposit(100))
print(acount.withdraw(100))
print(acount.withdraw(100))
print(acount.withdraw(100))
print(str(acount))
print(acount.withdraw(100))