Question: class BankSystem: def _ _ init _ _ ( self ) : self.balance = 0 self.is _ logged _ in = False def login (

class BankSystem:
def __init__(self):
self.balance =0
self.is_logged_in = False
def login(self, password):
if password =='1234':
self.is_logged_in = True
print("Login successful.")
else:
print("Incorrect password.")
def logout(self):
self.is_logged_in = False
print("Logged out.")
def deposit(self, amount):
if self.is_logged_in:
self.balance += amount
print(f"Deposited \$ {amount}. New balance is \$ {self.balance}.")
else:
print("Please login first.")
def withdraw(self, amount):
if self.is_logged_in:
if amount <= self.balance:
self.balance -= amount
print(f"Withdrew \$ {amount}. New balance is \$ {self.balance}.")
else:
print("Insufficient balance.")
else:
print("Please login first.")
bank = BankSystem()
bank.login('1234')
bank.deposit(1000)
bank.withdraw(500)
bank.logout() draw graph for that code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!