title: Python Classes with Loops: Bank Accounts
body: <p>I'm having a huge issue and I really don't know what's wrong with this code I wrote, it definitely has something to do with the inputs I set up for my input file but i'm at a wall and I truly don't know how to proceed</p>
  
  <p>I'm getting a name error for the inputs but this is how the book shows me how to set up the first Deposit. The input file is below the main program.</p>
  
  <p>My question is, does anyone know what is wrong with the inputs I set out in the main? They seem to be correct but I keep getting a NameError: ABC123 is not defined for every change I try to put out.</p>
  
  <pre><code>class BankAccount:
      def __init__(self, getbankaccount, inputAmount=0):
          self.__balance = inputAmount
          self.__numDeposits = 0
          self.__numWithdrawals = 0
          self.__totalDeposits = 0
          self.__totalWithdrawals = 0
          self.__getbankaccount=getbankaccount
  
      def getBalance(self):
          return self.__balance
  
      def getNumDeposits(self):
          return self.__numDeposits
  
      def getNumWithdrawals(self):
          return self.__numWithdrawals
  
      def getTotalDeposits(self):
          return self.__totalDeposits
  
      def getTotalWithdrawals(self):
          return self.__totalWithdrawals
  
      def getbankaccount(self):
          return self.__getbankaccount
  
      def Deposit(self,amount):
          self.__balance = self.__balance + amount
          self.__numDeposits = self.__numDeposits + 1
          self.__totalDeposits = self.__totalDeposits + amount
          return self.__balance
  
      def Withdrawal(self,amount):
          if (self.__balance &gt;= amount):
              self.__balance = self.__balance - amount
              self.__numWithdrawals = self.__numWithdrawals + 1
              self.__totalWithdrawals = self.__totalWithdrawals + amount
              return True
          else:
              return False
  
  def main():
      acctlist=[]
      account=input()
      amount=eval(input())
      type=input()
  
      while(type!='#'):
          if (type=='D'):
              account=input()
              amount=eval(input())
              for i in range(len(acctlist())):
                  if (account==acctlist[i].getbankaccount()):
                      index=i
                  acctlist[index].Deposit(amount)
                  PrintSuccessfullTrans(account, type, amount, acctlist[index].getBalance())
          elif (type=='W'):
              account=input()
              amount=eval(input())
              for i in range(len(acctlist())):
                  if (account==acctlist[i].getbankaccount()):
                      index=i
                      status=(acctlist[index].Withdrawal(amount))
                      if (status == True):
                          PrintSuccessfulTrans(account, type, amount, acctlist[index].getbalance())
                      else:
                          PrintDenied(account, type, amount, "&lt;DENIED&gt;")
          elif (type == 'B'):
              type=ConvertType(type)
              amount=eval(input)
              print(acctlist[i].getbankaccount(), amount)
          elif (type == 'T'):
              account1=input()
              account2=input()
              amount=eval(input())
              for i in range(len(acctlist())):
                  if (accoun1t==acctlist[i].getbankaccount()):
                      index=i
                      acctlist[index].Deposit(amount)
                      if status == True:
                          print('Test1')
                      else:
                          print('Test2')
              for g in range(len(acctlist())):
                  if (account2==acctlist[i].getbankaccount()):
                      index=g
                      acctlist[index].Withdrawal(amount)
  
          account=input()
          amount=eval(input())
          type=input()
  
  
  def PrintSuccessfulTrans(account,type, amount, balance):
                  typeName = ConvertType(type)
                  print("{:8s}{:12}{:8.2f}{:12.2f}".format(account,typeName,amount,balance))
  
  
  def PrintDenied(account,type,amount, balance):
                  typeName = ConvertType(type)
                  print("{:8s}{:12}{:8.2f}{:&gt;12}".format(account,typeName,amount,balance))
  
  def ConvertType(type):
                  if (type == 'D'):
                      return "Deposit"
  
                  elif (type == 'W'):
                      return "Withdrawal"
  
                  elif (type == 'B'):
                      return "Balance"
  main()
  </code></pre>
  
  
  
  <pre><code>11
  ABC123
  500
  DEF456
  1000
  XYZ999
  2056
  MNI612
  2012
  CKE909
  1313
  THM115
  5783
  WBS319
  2041
  GFL522
  10238
  JDT121
  876
  JFL216
  9218
  GRP904
  820
  W
  JFL216
  587.24
  D
  MNI612
  420.45
  D
  XYZ999
  214.38
  W
  THM115
  1045.23
  D
  WBS319
  258.30
  W
  JDT121
  924.10
  T
  GFL522
  JDT121
  2000
  B
  GFL522
  0
  B
  XYZ999
  0
  T
  DEF456
  ABC123
  50.50
  #
  #
  </code></pre>