I am trying to figure out what I am missing to get this to work.
I am not sure how to get the account balance to change as the user continues to do more transactions. Here is the code I've written so far but now I'm stuck.
import math

def getInput():
account number = input(“Enter your account number:”)
x= 100.11
print("Account Balance is: x")

print(“\nEnter your choice of task.”)
nextTask = input(“D to make a deposit:, ”\
“W to make a withdraw: ”)
ammount = float(input("Enter ammount:")
return nextTask

def doDeposit(add):
  deposit = x+ammount
  print(”\nYour new balance is:”, deposit)

def doWithdraw(subtract):
withdraw = x-ammount
  print(”\nYour new balance is:”, withdaw)

def inOut(x):
x = (x+deposit, ”\
x-withdraw);
return x

def main():
print(“Do you want another transaction?”)
more = input(“Enter Y or N: ”)
while(more == “Y”) or (more == “y”):
   #more money to process
    taskToDo = getInput( )
   if taskToDo == “D”: #compute deposit
     doDeposit(add)
else: #compute withdraw
doWithdraw(subtract)
print(“Do you want another transaction?”)
more = input(“Enter Y or N: ”)
#program starts here
main()
#finish up
input(“\n\nPress the Enter key to exit”)

Fix your indentation is wrong in many places.
This has to be right in python.

You do not return the amount from getInput (Python naming conventions) so you have no amount to work with. Also, one function will suffice for deposits and withdrawals. This is an example only.

def deposit_withdrawal(this_task, amount, balance):
    if this_task == "d":
        return balance + amount
    else:
        return balance - amount
       
def get_input(balance):
    account number = input(“Enter your account number:”)
    print("Account Balance is: ", balance)
       
    next_task = ""
    while next_task not in ["d", "w"]:
        print(“\nEnter your choice of task.”)
        next_task = input(":'D' to make a deposit:, 'W' to make a withdraw: "
        next_task = next_task.lower()
        amount = float(input("Enter amount:")
    return nextTask, amount
       
if __name__ == "__main__":
    balance = 110.01
    more = "y"
    while more == “y”:
        print(“Do you want another transaction?”)
        more = input(“Enter Y or N: ”)
        more = more.lower()
       
        task_to_do, amount = get_input(balance)
        balance = deposit_withdraw(task_to_do, amount, balance)

    input(“\n\nPress the Enter key to exit”)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.