Banking Transaction System with Transaction History Dry Run in PYTHON

Banking Transaction System with Transaction History is an interactive PYTHON dry run visualizer from the While programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.

This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.

Banking Transaction System with Transaction History Program Code

# Banking system with transaction history
balance = 10000
transactions = []

print("=== BANKING SYSTEM ===")

while True:
    print("\n1. Check Balance")
    print("2. Deposit Money")
    print("3. Withdraw Money")
    print("4. View Transaction History")
    print("5. Exit")
    
    choice = input("Enter your choice (1-5): ")
    
    if choice == "1":
        print(f"Current Balance: ₹{balance:.2f}")
    
    elif choice == "2":
        amount = float(input("Enter amount to deposit: "))
        if amount > 0:
            balance += amount
            transactions.append(f"Deposited: +₹{amount:.2f}")
            print(f" Deposited ₹{amount:.2f}")
        else:
            print(" Invalid amount!")
    
    elif choice == "3":
        amount = float(input("Enter amount to withdraw: "))
        if amount > 0 and amount <= balance:
            balance -= amount
            transactions.append(f"Withdrawn: -₹{amount:.2f}")
            print(f" Withdrawn ₹{amount:.2f}")
        elif amount > balance:
            print(f" Insufficient balance! Available: ₹{balance:.2f}")
        else:
            print(" Invalid amount!")
    
    elif choice == "4":
        if transactions:
            print("\n=== TRANSACTION HISTORY ===")
            for trans in transactions:
                print(trans)
            print(f"Current Balance: ₹{balance:.2f}")
        else:
            print("No transactions yet.")
    
    elif choice == "5":
        print("Thank you for banking with us!")
        break
    
    else:
        print("Invalid choice! Please enter 1-5")

View the complete While programs page.

Program Console Banking Transaction System with Transaction History Topic: PYTHON Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.