So I'm trying to fully understand Python OOP by creating a class but I'm really confused about this error I keep getting. Still learning so please try to understand my beginner situation here.

```
  class Investor:

    def __init__(self, name, principle, returns):
        self.name = name
        self.principle = principle
        self.returns = returns 

    def info(self):
        return '{} {}'.format(self.name, self.principle)

    def deposit(self):
        global deposit_amount

        deposit_amount = float(input('Amount: '))
        return deposit_amount + self.principle + self.returns

    def withdraw(self):
        global withdraw_amount

        withdraw_amount = float(input('Withdraw amount: '))
        return self.principle + self.returns + deposit_amount - withdraw_amount

    def balance(self):
        if deposit_amount > 0 or withdraw_amount > 0:
            return self.principle + self.returns + deposit_amount - withdraw_amount
        else:
            return self.principle + self.returns

investor1 = Investor('John', 5000, 0)

while True:
    prompt = input('What would you like to do?\n')
    if prompt == 'Balance':
        try:
            print(investor1.balance())
        except ValueError:
            print(investor1.info())

    elif prompt == 'Deposit':
        print(investor1.deposit())

    elif prompt == 'Withdraw':
        print(investor1.withdraw())

```

Output:

```
What would you like to do?

```

When I first enter `Deposit` and then `Withdraw` and ***then*** `Balance` the code works perfectly fine.

However, when I input `Balance` first, I get the following error:

```
return self.principle + self.returns + deposit_amount - withdraw_amount
NameError: name 'deposit_amount' is not defined

```

Any help, folks?