I'm new to python...so i was trying to run this code but the error says menu() missing 1 required positional argument: 'self' after the while statement. However, when i added self the error says name 'self' is not defined. What is the proper way to run this code?
class Account:
def __init__(self):
self.balance = 1000
def menu(self):
print("Options:")
print("1. Make Deposit")
print("2. Make a Withdrawl")
print("3. Obtain Balance")
print("4. Quit")
def deposit(self):
depositAmount = float(input("Enter amount of deposit: "))
print("Deposit processed")
self.balance += depositAmount
def withdrawl(self):
withdrawalAmount = float(input("Enter amount of withdrawl: "))
if withdrawalAmount > 1500:
print("Denied. Maximum withdrawl is $1,500.00")
elif withdrawalAmount > self.balance:
print("Insufficient balance")
else:
self.balance -= withdrawalAmount
def balance(self):
print(self.balance)
def exit(self):
quit()
def main():
while True:
Account.menu()
choice = int(input("Make a selection from the options menu: "))
if choice == 1:
Account.deposit()
elif choice == 2:
Account.withdrawl()
elif choice == 3:
Account.balance()
elif choice == 4:
quit()
break
if __name__ == "__main__":
main()