Jul-24-2017, 10:31 AM
(Jul-23-2017, 11:04 PM)ichabod801 Wrote:return data[pin]Not
return True
d1 = 0 d2 = 0 d3 = 0 y1 = 0 w1 = 0 pin = 0 class Bank_Account: def pincheck(self, pin): if pin in data: data[pin] return data[pin] else: return False print("WRONG PIN") # constructor or initializer def __init__(self, name, money, pin1): self.__name = name self.__balance = money # __balance is private now, so it is only accessible inside the class self.__pin = pin1 def deposit(self, money): self.__balance += money def withdraw(self, money): if self.__balance > money : self.__balance -= money return money else: return "Insufficient funds" def checkbalance(self): return self.__balance def next_step(): while True: y2 = int(input("Enter 1 if you want to make a withdrawal, enter 2 if you don't")) if y2 == 1: enter_pin() else: print("ERROR, TRY AGAIN") Bone = Bank_Account('Obi Ezeakachi', 5000, 1111) Btwo = Bank_Account('Tasha St.Patrick', 80000 , 2222) Bthree = Bank_Account('Tommy Egan', 7000, 3333) data = {'1111': Bone , '2222' : Btwo , '3333' : Bthree } data = {int(pin):value for key, value in data.items()} def enter_pin(): while True: pin = int( input("Enter pin "))# keeps asking for the correct pin if pin in data: data[pin] return data[pin] else: print("INCORRECT PIN TRY AGAIN") still gives " Incorrect pin try again whenever i try to enter any of the pins" **snooty**