Question: def clear _ screen ( ) : print ( ) def enter _ pin ( ) : correct _ pin = 1
def clearscreen:
print
def enterpin:
correctpin
attempts
while attempts :
pin inputPlease enter your PIN:
if pin correctpin:
return True
else:
printInvalid PIN. Please try again."
attempts
clearscreen
printToo many illegal PINs. Try again later."
return False
def showmenu:
print Welcome to the ATM system
print Checking account balance"
print Savings account balance"
print Withdraw Cash from either account"
print Deposit"
print Transfer from savings account to checking account"
print Transfer from checking account to savings account"
print Exit"
def transferfundsfromaccount, toaccount, amount:
if amount fromaccountbalance:
printTransaction not completed. Insufficient funds."
printfCurrent Balance: $fromaccountbalance:f
else:
fromaccountbalance amount
toaccountbalance amount
printfTransaction successful. Transferred $amount:f
def withdrawcashaccount amount:
if amount accountbalance:
printTransaction not completed. Insufficient funds."
printfCurrent Balance: $accountbalance:f
else:
accountbalance amount
printfTransaction successful. Withdrawn $amount:f
def main:
checkingaccount balance:
savingsaccount balance:
if not enterpin:
return
choice
while choice :
showmenu
choice inputPlease select option :
clearscreen
if choice :
printfChecking Account Balance: $checkingaccountbalance:f
elif choice :
printfSavings Account Balance: $savingsaccountbalance:f
elif choice :
accountchoice inputWithdraw from: Checking Saving:
amount floatinputEnter withdrawal amount: $
if accountchoice :
withdrawcashcheckingaccount, amount
elif accountchoice :
withdrawcashsavingsaccount, amount
else:
printInvalid choice. Please select for Checking or for Saving."
elif choice :
amount floatinputEnter amount to transfer from savings to checking: $
transferfundssavingsaccount, checkingaccount, amount
elif choice :
amount floatinputEnter amount to transfer from checking to savings: $
transferfundscheckingaccount, savingsaccount, amount
elif choice :
printThank you for using the ATM system."
else:
printInvalid option. Please choose a valid option
if namemain:
main
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
