Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main_menu():
- print("Select an option:")
- print("1. Deposit")
- print("2. Withdrawal")
- print("3. Check account balance")
- print("4. Exit")
- def get_customer_choice():
- return int(input("your choice is: "))
- def get_amount(text):
- return float(input(text))
- def show_account_balance(balance):
- print(f"The account balance is {balance}")
- def deposit(balance):
- deposit_amount = get_amount("How much would you like to deposit?")
- balance = balance + deposit_amount
- show_account_balance (balance)
- return balance
- def withdrawal(balance):
- withdrawal_amount = get_amount("How much would you like to withdraw?")
- if withdrawal_amount > balance:
- print("Operation failed, not enough funds on the account ")
- return balance
- else:
- balance -= withdrawal_amount
- print(f"The amount withdrawn {withdrawal_amount}")
- return balance
- #we write all the functions of our program above!!!
- choice = 0
- balance = 0
- #below is the main loop of the program
- while choice != 4:
- main_menu()
- choice = get_customer_choice()
- if choice == 1:
- balance = deposit(balance)
- pass
- elif choice == 2:
- balance = withdrawal(balance)
- pass
- elif choice == 3:
- show_account_balance(balance)
- pass
- elif choice == 4:
- print("Shutting down the ATM")
- pass
- else:
- print("Invalid data")
- pass
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement