Python Program that computes the net amount of a bank account based a transaction log from console input.

 


#D or d means deposit while W or w means withdrawal.


bal=0

while('true'):

    ch = input ('''Enter d or D for Deposit

Enter w or W to Withdraw

Enter x to exit

''')

    if (ch=='d' or ch == 'D'):

        amt = int (input ('Enter amount: '))

        bal += amt

    elif (ch=='w' or ch == 'W'):

        amt = int (input ('Enter amount: '))

        bal-= amt

    else:

        print (bal)

        break

Comments

Some popular posts