So I'm writing a personal bank tracker for myself, and I'm having a bit of trouble with a line of code. The ID_Pin method below is equal to 0000, however when i try to create an instance (any instance of the Account class), it returns the "Access Denied" bit that I wrote(ID_Pin), even when the instance pin matches the method pin. Any suggestions?
class Account:
'''Wells Fargo.'''
global balance
def __init__(self, name, pin_number, balance=100):
self.name = name
self.pin_number = pin_number
self.balance = 100
def alter_pin(self, enter_a_pin):
'''To be used a later revision, changes a pin number.'''
ID_List = []
enter_a_pin.append(ID_List)
def ID_Pin(self):
pin = 0000
return pin
def get_balance(self, pin_number):
if pin_number == Account.ID_Pin:
print("Balance: %d" % self.balance)
else:
print("Access denied: Incorrect PIN.")
def withdraw(self,pin_number, amount):
if pin_number == Account.pin:
balance -= amount
print("Withdrew %d. New Balance: %d" % amount, balance)
else:
print("Access denied: Incorrect PIN.")
def deposit(self, pin_number, amount):
if pin_number == Account.ID_Pin:
balance += amount
print("Deposited %d. New Balance: %d" % amount, balance)
if balance <= 0:
print("Balance limit reached!")
else:
print("Access denied: Incorrect PIN.")
New_Bank_Account = Account("person",0000,100)
New_Bank_Account.get_balance(0000)
New_Bank_Account.deposit(0000, 50000)