mms
Thu Dec 12 2024 10:01:06 GMT+0000 (Coordinated Universal Time)
Saved by
@login123
class Bank:
acbal=20000
def deposit(self,dep):
m = dep % 100
if dep >= 100 and dep <= 50000 and m == 0:
self.acbal += dep
print(self.acbal)
else:
print("invalid")
def withdraw(self,wt):
n=wt%100
if wt>=100 and n==0 and self.acbal>=wt:
self.acbal -=wt
print(self.acbal)
else:
print("invalid")
def balanceenq(self,bal):
print("current balance is",self.acbal)
def viewoptions(self):
print("1.deposit")
print("2.withdraw")
print("3.balance")
print("0.Exit")
def validate(self):
count =0
while count<3:
pin = int(input("enter the pin"))
if pin == 1234:
obj.viewoptions()
while True:
choice = int(input("Enter choice"))
if choice == 1:
dep = int(input("Enter amount"))
self.deposit(dep)
self.viewoptions()
elif choice == 2:
wt = int(input("enter withdraw amount"))
self.withdraw(wt)
elif choice == 3:
self.balanceenq(self.acbal)
elif choice==0:
break
else:
Print("Invalid choice")
return
else:
print("invalid")
count +=1
if count < 3:
print(("reenter the pin"))
else:
print("try again after some time")
obj=Bank()
obj.validate()
content_copyCOPY
Comments