Question: def clear _ screen ( ) : print ( ) def enter _ pin ( ) : correct _ pin = 1

def clear_screen():
print("
")
def enter_pin():
correct_pin ="1553"
attempts =0
while attempts <3:
pin = input("Please enter your PIN: ")
if pin == correct_pin:
return True
else:
print("Invalid PIN. Please try again.")
attempts +=1
clear_screen()
print("Too many illegal PINs. Try again later.")
return False
def show_menu():
print("*** Welcome to the ATM system ***")
print("1) Checking account balance")
print("2) Savings account balance")
print("3) Withdraw Cash from either account")
print("4) Deposit")
print("5) Transfer from savings account to checking account")
print("6) Transfer from checking account to savings account")
print("7) Exit")
def transfer_funds(from_account, to_account, amount):
if amount > from_account['balance']:
print("Transaction not completed. Insufficient funds.")
print(f"Current Balance: ${from_account['balance']:.2f}")
else:
from_account['balance']-= amount
to_account['balance']+= amount
print(f"Transaction successful. Transferred ${amount:.2f}.")
def withdraw_cash(account, amount):
if amount > account['balance']:
print("Transaction not completed. Insufficient funds.")
print(f"Current Balance: ${account['balance']:.2f}")
else:
account['balance']-= amount
print(f"Transaction successful. Withdrawn ${amount:.2f}.")
def main():
checking_account ={'balance': 2395.63}
savings_account ={'balance': 0}
if not enter_pin():
return
choice =''
while choice !='7':
show_menu()
choice = input("Please select option (1-7): ")
clear_screen()
if choice =='1':
print(f"Checking Account Balance: ${checking_account['balance']:.2f}")
elif choice =='2':
print(f"Savings Account Balance: ${savings_account['balance']:.2f}")
elif choice =='3':
account_choice = input("Withdraw from: 1) Checking 2) Saving: ")
amount = float(input("Enter withdrawal amount: $"))
if account_choice =='1':
withdraw_cash(checking_account, amount)
elif account_choice =='2':
withdraw_cash(savings_account, amount)
else:
print("Invalid choice. Please select 1 for Checking or 2 for Saving.")
elif choice =='5':
amount = float(input("Enter amount to transfer from savings to checking: $"))
transfer_funds(savings_account, checking_account, amount)
elif choice =='6':
amount = float(input("Enter amount to transfer from checking to savings: $"))
transfer_funds(checking_account, savings_account, amount)
elif choice =='7':
print("Thank you for using the ATM system.")
else:
print("Invalid option. Please choose a valid option (1-7).")
if __name__=="__main__":
main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!