Bank Account system make using object oriented programming in python.

Bank Account system make using object oriented programming in python.





All Source Code:-

import sys
class Bank:
  def __init__(self, name,Bal=0.0):
    self.name=name
    self.Bal=Bal

  def deposite(self,amount):
    self.Bal+=amount
    return self.Bal
    
  def withdral(self,amount):
    if(amount> self.Bal):
      print("Balance is Less, so no withdral")
    else:
      self.Bal-=amount
      return self.Bal
 
name=input("Enter name:")
B=Bank(name)
while(True):
  print('''Enter D-for Deposite:
           Enter W-withdral
           Enter E-for Exit:''')
  
  choice=input("Enter your Choice")
  if(choice=="e" or choice=="E"):
    sys.exit()
  amt=float(input("Enter amount:"))
  
  if(choice=="d" or choice=="D"):
    print("Balance after Deposite:",B.deposite(amt))
  elif(choice=="w" or choice=="W" ):
    print("Balance after withdral:", B.withdral(amt))
  

Previous Post Next Post