17 lines
482 B
Python
17 lines
482 B
Python
class BankAccount:
|
|
def __init__(self, owner: str, balance: float):
|
|
self.owner = owner
|
|
self.balance = balance
|
|
|
|
def deposit(self, amount: float):
|
|
self.balance += amount
|
|
return self.balance
|
|
|
|
def withdraw(self, amount: float):
|
|
if self.balance < amount:
|
|
raise ValueError()
|
|
self.balance -= amount
|
|
return self.balance
|
|
|
|
def __str__(self):
|
|
return f"Owner: {self.owner}, Balance: {self.balance}"
|