Question: Python 3 -The ATM Code works BUT I got points off for the following. I just cannot see how to put her suggestions in without

Python 3 -The ATM Code works BUT I got points off for the following. I just cannot see how to put her suggestions in without messing up my code. **Your functions did not contain any input parameters. You want to prompt for the input (deposit amount or withdrawal amount) and send that into the function when you call it. Here are some examples: deposit(deposit_amount): or withdraw(withdrawal_amount): Make sure your comments use the keywords 'input parameters' where you have used them.**

import sys

import sys

#account balance account_balance = float(500.25)

#<--------functions go here--------------------> # Define printbalance function. It is returning the current balance with 2 decimal places. def printbalance(): print("Your current balance is") return account_balance

#Define the deposit function. Allows the user to enter deposit amount. def deposit(): #Input for deposit amount. deposit_amount = float(input("How much would you like to deposit today? ")) #Balance calculation in c = a + b format. balance = account_balance + deposit_amount #Output of deposit amount and current balance amount. print("Deposit was $%.2f, current balance is $%.2f" %(deposit_amount,balance)) #Define the withdrawal function. Allows the user to enter the withdrawal amount. def withdraw(): #Input for withdrawal amount withdrawal_amount = float(input("How much would you like to withdraw today? ")) #This checks if the withdrawal amount is greater than the balance. if(withdrawal_amount > account_balance): #If so, this the output will tell the user that the amount is greater #than their account balance. print("$%.2f is greater than your account balance of $%.2f " %(withdrawal_amount,account_balance)) else: #Balance calculation in c = a - b format. balance = account_balance - withdrawal_amount #If not, the output will state the amount and the current account balance. print("Withdrawal amount was $%.2f, current balance is $%.2f" % (withdrawal_amount, balance)) #The user input is entered and an if/else conditional statement is used to #call the function based on user input. userchoice = input("What would you like to do? ")

#Deposit function is called. if (userchoice == 'D'): deposit()

#Withdrawal function is called. elif userchoice == 'W': withdraw() #Printbalance function is called. elif userchoice == 'B': balance = printbalance() #Outputs the balance in float format. print('{:.2f}'.format(balance)) else: #If user selects any other choice, this will be the output. print("Thank you for banking with us.") #The program is ended. sys.exit()

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 Databases Questions!