[Solved] class dictionary not updating [closed]


Hey bud I only have so much time a day to spend on this but I worked out a little better framwework for you to play with, try using elements in here working with it and modifying it, the skeleton of it should help you get all your goals accomplished with this certain code. I’ll be back with more updates when I have time just wanted to give you something to play with! Enjoy!

class Account:
    """set stuff"""

    def __init__(self):
        self.accounts = []

    def set_name(self):
        print(self.accounts)
        self.name = input("Enter the name of the Account Owner: ")
        self.accounts.append(self.name)
        print(self.accounts)

    def set_balance(self):
        self.balance = int(input("Enter Starting Balance: "))

    def deposit_amount(self):
        self.deposit = int(input("Enter Deposit amount: "))
        self.balance += self.deposit

    def withdrawl(self):
        self.withdraw = int(input("Enter Withdrawl Amount: "))
        self.balance -= self.withdraw

    def close_account(self):
        name = input("Enter the Account Name: ")
        if name in self.accounts:
            self.accounts.remove(name)
        else:
            print("Account not Found.")
            self.imenu()

    def imenu(self):
        print("\n1. Get Account Balance\n"
              "2. Deposit\n"
              "3. Withdraw\n"
              "4. Close Account\n"
              "5. Exit\n")
        choice = -1
        while choice not in range (1, 6):
            try:
                choice = int(input("Enter your choice: "))
            except ValueError:
                continue
        if choice == 1:
            print(self.balance)
            self.imenu()
        if choice == 2:
            self.deposit_amount()
            print("Money added")
            self.imenu()
        elif choice == 3:
            self.withdrawl()
            self.imenu()
        elif choice == 4:
            individual.close_account()
            return
        elif choice == 5:
            return

class Individual(Account):
    pass

class Business(Account):

    def savings(self):
        self.savings = 0

    def savings_deposit(self):
        self.s_deposit = int(input("Enter Deposit amount to Savings: "))
        self.savings += self.s_deposit


while True:
    print("\nAre you ready to open/access an account? 1 = Yes, 3 = No")
    ans = 5
    while ans not in range(1,2):
        try:
            ans = int(input("Enter either 1 or 2: "))
        except ValueError:
            continue

    print("\nWelcome to the Bank!")
    print("\nSelect and option from the Menu")
    print("1. Open Individual Account\n"
          "2. Open a Business Account\n"
          "3. Check Indiviudal Account\n"
          "4. Check Business ACcount\n"
          "5. Exit")
    select = -1
    while select not in range(1, 6):
        try:
            select = int(input("Please enter your selection: "))
        except ValueError:
            continue

    if select == 1:
        print("\nCreating Individual Account...")
        individual = Individual()
        individual.set_name()
        individual.set_balance()

    elif select == 2:
        print("\nCreating Business Account...")
        business = Business()
        business.set_name()
        business.set_balance()

    elif select == 3:
        print("\nLoading Individual Accounts...")
        name = input("Enter your Name: ")
        if name in individual.accounts:
            print("\nYour account was found! Proceeding...")
            individual.imenu()



    elif select == 4:
        print("\nLoading Business Accounts...")
        name = input("Enter name of Business: ")
        if name in business.accounts:
            print("Your account was found. Proceeding...")
            business.imenu()
        else:
            print("Account not found.")

    elif select == 5:
        print("Thank you for using Bank, Have a Nice Day!")
        break

6

solved class dictionary not updating [closed]