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

Python Program which will find all such numbers between 1000 and 3000 (both included) such that each digit of the number is an even number.The numbers obtained should be printed in a comma-separated sequence on a single line