MainProgram3.py

From OpenHatch wiki
Jump to navigation Jump to search
   import banking3 as banking
   the_bank = banking.Bank()
   user_anna = the_bank.add_user("Anna","myPassword")
   print user_anna.username
   is_logged_in = the_bank.login(user_anna.username, user_anna.password)
   if is_logged_in:
       account_anna = the_bank.add_account(user_anna)
       account_anna.add_money(10)
   
   is_logged_in = the_bank.login(user_anna.username, "bad password")
   if is_logged_in:
       account_anna.withdraw_money(account_anna.balance)
   else:
       print "Bad user! No moneys for you."